diff --git a/scripts/customize.sh b/scripts/customize.sh index 905d9cf..101b40d 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -94,7 +94,7 @@ set_perm $MODPATH/base.apk 1000 1000 644 u:object_r:apk_data_file:s0 ui_print "- Mounting __PKGNAME" mkdir -p $NVBASE/rvhc -RVPATH=$NVBASE/rvhc/__PKGNAME_rv.apk +RVPATH=$NVBASE/rvhc/${MODPATH##*/}.apk mv -f $MODPATH/base.apk $RVPATH if ! op=$(nsenter -t1 -m -- mount -o bind $RVPATH $BASEPATH/base.apk 2>&1); then @@ -107,6 +107,7 @@ nohup cmd package compile --reset __PKGNAME >/dev/null 2>&1 & ui_print "- Cleanup" rm -rf $MODPATH/bin $MODPATH/__PKGNAME.apk +rm -rf $NVBASE/rvhc/__PKGNAME_rv.apk # rm this later for s in "uninstall.sh" "service.sh"; do sed -i "2 i\NVBASE=${NVBASE}" $MODPATH/$s diff --git a/scripts/service.sh b/scripts/service.sh index 7593e4e..01d0cc3 100755 --- a/scripts/service.sh +++ b/scripts/service.sh @@ -1,15 +1,16 @@ #!/system/bin/sh # shellcheck disable=SC2086 MODDIR=${0%/*} -RVPATH=${NVBASE}/rvhc/__PKGNAME_rv.apk +RVPATH=$NVBASE/rvhc/${MODDIR##*/}.apk until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done +until [ -d "/sdcard/Android" ]; do sleep 1; done while BASEPATH=$(pm path __PKGNAME) svcl=$? [ $svcl = 20 ] do sleep 2; done -sleep 4 +sleep 5 err() { [ ! -f $MODDIR/err ] && cp $MODDIR/module.prop $MODDIR/err diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 1cd9079..e83f7ca 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -1,10 +1,11 @@ #!/system/bin/sh { - rm $NVBASE/rvhc/__PKGNAME_rv.apk + MODDIR=${0%/*} + rm $NVBASE/rvhc/${MODDIR##*/}.apk rmdir $NVBASE/rvhc - if __ISBNDL; then - until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done - sleep 15 - pm uninstall __PKGNAME - fi + # if __ISBNDL; then + # until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done + # sleep 15 + # pm uninstall __PKGNAME + # fi } & diff --git a/utils.sh b/utils.sh index c3d2891..b035627 100755 --- a/utils.sh +++ b/utils.sh @@ -125,7 +125,7 @@ _req() { while [ -f "$dlp" ]; do sleep 1; done return fi - wget -nv -O "$dlp" --header="$3" "$1" + wget -nv -O "$dlp" --header="$3" "$1" || return 1 mv -f "$dlp" "$2" fi } @@ -195,14 +195,14 @@ dl_apkmirror() { if [ "$(sed -n 3p <<<"$app_table")" = "$apkorbundle" ] && { [ "$apkorbundle" = BUNDLE ] || { [ "$apkorbundle" = APK ] && [ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] && isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; }; }; then - dlurl=https://www.apkmirror.com$($HTMLQ --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node") + dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node") break fi done [ -z "$dlurl" ] && return 1 - url="https://www.apkmirror.com$(req "$dlurl" - | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p' | tail -1)" + url=$(req "$dlurl" - | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") if [ "$apkorbundle" = BUNDLE ] && [[ "$url" != *"&forcebaseapk=true" ]]; then url="${url}&forcebaseapk=true"; fi - url="https://www.apkmirror.com$(req "$url" - | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')" + url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") req "$url" "$output" } get_apkmirror_vers() {