module: update scripts

This commit is contained in:
j-hc 2023-01-17 02:31:51 +03:00
parent 43fc79aac9
commit cb2ee447c2
4 changed files with 21 additions and 13 deletions

View File

@ -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</div>[^@]*@\([^"]*\)'
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}"

View File

@ -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,7 +19,8 @@ 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
@ -34,7 +30,8 @@ else
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"

View File

@ -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

View File

@ -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"