diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 diff --git a/CONFIG.md b/CONFIG.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/build.sh b/build.sh index 51e69c2..2ba8a87 100755 --- a/build.sh +++ b/build.sh @@ -43,7 +43,11 @@ for table_name in $(toml_get_table_names); do app_args[allow_alpha_version]=$(toml_get "$t" allow-alpha-version) || app_args[allow_alpha_version]=false app_args[build_mode]=$(toml_get "$t" build-mode) || app_args[build_mode]=apk app_args[microg_patch]=$(toml_get "$t" microg-patch) || app_args[microg_patch]="" - app_args[uptodown_dlurl]=$(toml_get "$t" uptodown-dlurl) && app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%/} || app_args[uptodown_dlurl]="" + app_args[uptodown_dlurl]=$(toml_get "$t" uptodown-dlurl) && { + app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%/} + app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%download} + app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%/} + } || app_args[uptodown_dlurl]="" app_args[apkmirror_dlurl]=$(toml_get "$t" apkmirror-dlurl) && app_args[apkmirror_dlurl]=${app_args[apkmirror_dlurl]%/} || app_args[apkmirror_dlurl]="" app_args[arch]=$(toml_get "$t" arch) || app_args[arch]="all" @@ -58,7 +62,13 @@ for table_name in $(toml_get_table_names); do elif [ "${app_args[arch]}" = "arm-v7a" ]; then app_args[apkmirror_regex]='armeabi-v7a[^@]*@\([^"]*\)' fi - if [ "${app_args[apkmirror_dlurl]:-}" ] && [ "${app_args[apkmirror_regex]:-}" ]; then app_args[dl_from]=apkmirror; else app_args[dl_from]=uptodown; fi + if [ "${app_args[apkmirror_dlurl]:-}" ]; then + app_args[dl_from]=apkmirror + elif [ "${app_args[uptodown_dlurl]:-}" ]; then + app_args[dl_from]=uptodown + else + abort "ERROR: both 'apkmirror_dlurl' and 'uptodown_dlurl' were not set." + fi app_args[patcher_args]="$(join_args "${excluded_patches}" -e) $(join_args "${included_patches}" -i)" [ "$merge_integrations" = true ] && app_args[patcher_args]="${app_args[patcher_args]} -m ${RV_INTEGRATIONS_APK}" diff --git a/config.toml b/config.toml old mode 100644 new mode 100755 diff --git a/ks.keystore b/ks.keystore old mode 100644 new mode 100755 diff --git a/scripts/customize.sh b/scripts/customize.sh index a81d32b..fcc73f8 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -12,11 +12,6 @@ else fi set_perm_recursive $MODPATH/bin 0 0 0755 0777 -basepath() { - basepath=$(pm path __PKGNAME | grep base) - echo ${basepath#*:} -} - grep __PKGNAME /proc/self/mountinfo | while read -r line; do ui_print "- Un-mount" mountpoint=$(echo "$line" | cut -d' ' -f5) @@ -24,17 +19,19 @@ grep __PKGNAME /proc/self/mountinfo | while read -r line; do done am force-stop __PKGNAME -BASEPATH=$(basepath) +BASEPATH=$(pm path __PKGNAME | grep base) +BASEPATH=${BASEPATH#*:} if [ -n "$BASEPATH" ] && cmpr $BASEPATH $MODPATH/__PKGNAME.apk; then ui_print "- __PKGNAME is up-to-date" else ui_print "- Updating __PKGNAME (v__PKGVER)" set_perm $MODPATH/__PKGNAME.apk 1000 1000 644 u:object_r:apk_data_file:s0 - if ! op=$(cmd package install --user 0 -i com.android.vending -r -d $MODPATH/__PKGNAME.apk 2>&1); then + if ! op=$(pm install --user 0 -i com.android.vending -r -d $MODPATH/__PKGNAME.apk 2>&1); then ui_print "ERROR: APK installation failed!" abort "$op" fi - BASEPATH=$(basepath) + BASEPATH=$(pm path __PKGNAME | grep base) + BASEPATH=${BASEPATH#*:} if [ -z "$BASEPATH" ]; then abort "ERROR: install __PKGNAME manually and reflash the module" fi @@ -55,9 +52,10 @@ ui_print "- Mounting __PKGNAME" RVPATH=/data/adb/__PKGNAME_rv.apk ln -f $MODPATH/base.apk $RVPATH -if ! op=$(mount -o bind $RVPATH $BASEPATH 2>&1); then +if ! op=$(su -Mc mount -o bind $RVPATH $BASEPATH 2>&1); then ui_print "ERROR: Mount failed!" - abort "$op" + ui_print "$op" + abort "Flash the module in official Magisk Manager app" fi am force-stop __PKGNAME ui_print "- Optimizing __PKGNAME" diff --git a/scripts/service.sh b/scripts/service.sh old mode 100644 new mode 100755 index 52ffd71..28164fe --- a/scripts/service.sh +++ b/scripts/service.sh @@ -17,7 +17,7 @@ if [ $BASEPATH ] && [ -d ${BASEPATH%base.apk}lib ]; then umount -l "${mountpoint%%\\*}" done chcon u:object_r:apk_data_file:s0 $RVPATH - mount -o bind $RVPATH $BASEPATH + su -Mc mount -o bind $RVPATH $BASEPATH am force-stop __PKGNAME fi fi diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh old mode 100644 new mode 100755 diff --git a/utils.sh b/utils.sh index 4e1d862..c05b60d 100755 --- a/utils.sh +++ b/utils.sh @@ -71,7 +71,7 @@ get_cmpr() { dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a" } -abort() { echo "abort: $1" && exit 1; } +abort() { echo >&2 "abort: $1" && exit 1; } set_prebuilts() { [ -d "$TEMP_DIR" ] || abort "${TEMP_DIR} directory could not be found"