From 9f1e0ab188e1b23e7bfea66f7ce37359cec86b30 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sun, 12 Feb 2023 20:00:41 +0300 Subject: [PATCH] module: new mount script once again --- scripts/customize.sh | 5 +---- scripts/service.sh | 22 ++++++++++++++-------- scripts/uninstall.sh | 7 +++++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/customize.sh b/scripts/customize.sh index 31667a4..9c91e63 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -81,10 +81,7 @@ ui_print "* Optimizing __PKGNAME" cmd package compile --reset __PKGNAME & ui_print "* Cleanup" -rm -rf $MODPATH/bin $MODPATH/__PKGNAME.apk $NVBASE/__PKGNAME_rv.apk -for s in "uninstall.sh" "service.sh"; do - sed -i "2 i\NVBASE=${NVBASE}" $MODPATH/$s -done +rm -rf $MODPATH/bin $MODPATH/__PKGNAME.apk ui_print "* Done" ui_print " by j-hc (github.com/j-hc)" diff --git a/scripts/service.sh b/scripts/service.sh index e249b89..4a4935d 100755 --- a/scripts/service.sh +++ b/scripts/service.sh @@ -1,20 +1,26 @@ #!/system/bin/sh # shellcheck disable=SC2086 MODDIR=${0%/*} -RVPATH=${NVBASE}/rvhc/__PKGNAME_rv.apk +MODULES=${MODDIR%/*} +RVPATH=${MODULES%/*}/rvhc/__PKGNAME_rv.apk + until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done -until [ "$(getprop init.svc.bootanim)" = stopped ]; do sleep 1; done -sleep 3 +while + BASEPATH=$(pm path __PKGNAME) + svcl=$? + [ $svcl = 20 ] +do sleep 1; done +sleep 5 err() { [ ! -f $MODDIR/err ] && cp $MODDIR/module.prop $MODDIR/err sed -i "s/^des.*/description=⚠️ Module is inactive: ${1}/g" $MODDIR/module.prop } -BASEPATH=$(pm path __PKGNAME | grep base) -BASEPATH=${BASEPATH#*:} -if [ $BASEPATH ]; then - if [ -d ${BASEPATH%base.apk}lib ]; then +if [ $svcl = 0 ]; then + BASEPATH=${BASEPATH##*:} + BASEPATH=${BASEPATH%/*} + if [ -d $BASEPATH/lib ]; then VERSION=$(dumpsys package __PKGNAME | grep -m1 versionName) if [ ${VERSION#*=} = __PKGVER ]; then grep __PKGNAME /proc/mounts | while read -r line; do @@ -23,7 +29,7 @@ if [ $BASEPATH ]; then umount -l ${mp%%\\*} done if chcon u:object_r:apk_data_file:s0 $RVPATH; then - mount -o bind $RVPATH $BASEPATH + mount -o bind $RVPATH $BASEPATH/base.apk am force-stop __PKGNAME [ -f $MODDIR/err ] && mv -f $MODDIR/err $MODDIR/module.prop else diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 9499899..84b56c0 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -1,7 +1,10 @@ #!/system/bin/sh { - rm ${NVBASE}/rvhc/__PKGNAME_rv.apk - rmdir ${NVBASE}/rvhc + MODDIR=${0%/*} + MODULES=${MODDIR%/*} + NVBASE=${MODULES%/*} + rm $NVBASE/rvhc/__PKGNAME_rv.apk + rmdir $NVBASE/rvhc if __ISBNDL :; then until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done until [ "$(getprop init.svc.bootanim)" = stopped ]; do sleep 1; done