Skip to content

Commit

Permalink
Merge branch 'micro5k:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git authored Feb 9, 2025
2 parents 724b470 + 436766f commit 8fa043f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ microG unofficial installer

Description
-----------
microG unofficial installer is a flashable zip created for a simple installation of microG on Android.
microG unofficial installer is a flashable zip created for a simple installation of microG on Android from 2.2 to 15.

This project is available on GitHub_, on GitLab_ as well as on XDA_.

Expand Down
32 changes: 20 additions & 12 deletions zip-content/inc/common-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1149,9 +1149,9 @@ get_free_disk_space_of_partition()
{
local _stat_result

if _stat_result="$(stat 2> /dev/null -f -c '%f * %S' -- "${1:?}")"; then
if _stat_result="$(stat 2> /dev/null -f -c '%a * %S' -- "${1:?}")"; then
: # OK
elif test -n "${DEVICE_STAT?}" && _stat_result="$(PATH="${PREVIOUS_PATH:?}" "${DEVICE_STAT:?}" 2> /dev/null -f -c '%f * %S' -- "${1:?}")"; then
elif test -n "${DEVICE_STAT?}" && _stat_result="$(PATH="${PREVIOUS_PATH:?}" "${DEVICE_STAT:?}" 2> /dev/null -f -c '%a * %S' -- "${1:?}")"; then
: # OK
else
_stat_result=''
Expand Down Expand Up @@ -1234,7 +1234,7 @@ verify_disk_space()
if _free_space_bytes="$(get_free_disk_space_of_partition "${1:?}")" && test -n "${_free_space_bytes?}"; then
ui_msg "Free disk space: $(convert_bytes_to_mb "${_free_space_bytes:?}" || :) MB ($(convert_bytes_to_human_readable_format "${_free_space_bytes:?}" || :))"
else
ui_warning "Unable to get free disk space, output for '${1?}' => $(stat -f -c '%f * %S' -- "${1:?}" || :)"
ui_warning "Unable to get free disk space, output for '${1?}' => $(stat -f -c '%a * %S' -- "${1:?}" || :)"
_free_space_bytes='-1'
fi

Expand All @@ -1254,19 +1254,22 @@ verify_disk_space()
perform_secure_copy_to_device()
{
if test ! -e "${TMP_PATH:?}/files/${1:?}"; then return 0; fi
local _error_text=''
local _error_text

ui_debug " Copying the '${1?}' folder to the device..."
create_dir "${SYS_PATH:?}/${1:?}"
_error_text=''

if {
cp 2> /dev/null -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}"/ ||
_error_text="$(cp 2>&1 -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}"/)"
} && _custom_rollback "${1:?}"; then
if
{
cp 2> /dev/null -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}/" ||
_error_text="$(cp 2>&1 -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}/")"
} && _custom_rollback "${1:?}"
then
return 0
elif _is_free_space_error "${_error_text?}"; then
while _do_rollback_last_app "${1:?}"; do
if ! _something_exists "${TMP_PATH:?}/files/${1:?}"/* || cp 2> /dev/null -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}"/; then
if ! _something_exists "${TMP_PATH:?}/files/${1:?}"/* || cp 2> /dev/null -r -p -f -- "${TMP_PATH:?}/files/${1:?}"/* "${SYS_PATH:?}/${1:?}/"; then
if test -n "${_error_text?}"; then
ui_recovered_error "$(printf '%s\n' "${_error_text:?}" | head -n 1 || true)"
else
Expand All @@ -1285,15 +1288,20 @@ perform_secure_copy_to_device()
df 2> /dev/null -h -T -- "${SYS_MOUNTPOINT:?}" || df -h -- "${SYS_MOUNTPOINT:?}" || :
ui_debug ''

local _free_space_bytes
local _ret_code _free_space_bytes

if _free_space_bytes="$(get_free_disk_space_of_partition "${SYS_PATH:?}")" && test -n "${_free_space_bytes?}"; then
ui_debug "Free disk space: $(convert_bytes_to_mb "${_free_space_bytes:?}" || :) MB ($(convert_bytes_to_human_readable_format "${_free_space_bytes:?}" || :))"
ui_debug ''
fi

_ret_code=5
! _is_free_space_error "${_error_text?}" || _ret_code=28

if test -n "${_error_text?}"; then
ui_error "Failed to copy '${1?}' to the device due to => $(printf '%s\n' "${_error_text?}" | head -n 1 || :)"
ui_error "Failed to copy '${1?}' to the device due to => $(printf '%s\n' "${_error_text?}" | head -n 1 || :)" "${_ret_code?}"
fi
ui_error "Failed to copy '${1?}' to the device"
ui_error "Failed to copy '${1?}' to the device" "${_ret_code?}"
}

perform_installation()
Expand Down
2 changes: 1 addition & 1 deletion zip-content/module.prop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

id=microg-unofficial-installer
name=microG unofficial installer
version=v1.3.1.73-alpha
version=v1.3.1.74-alpha
versionCode=5
author=ale5000
description=It installs microG on Android.
Expand Down

0 comments on commit 8fa043f

Please sign in to comment.