diff --git a/revanced-magisk/customize.sh b/revanced-magisk/customize.sh index bd26a65e8f..6a34159d8d 100755 --- a/revanced-magisk/customize.sh +++ b/revanced-magisk/customize.sh @@ -6,8 +6,6 @@ if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then Your device: $ARCH Module: $MODULE_ARCH" fi - -alias cmpr="$MODPATH/bin/$ARCH/cmpr" if [ "$ARCH" = "arm" ]; then ARCH_LIB=armeabi-v7a elif [ "$ARCH" = "arm64" ]; then @@ -23,9 +21,7 @@ set_perm_recursive "$MODPATH/bin" 0 0 0755 0777 if su -M -c true >/dev/null 2>/dev/null; then alias mm='su -M -c' -else - alias mm='nsenter -t1 -m' -fi +else alias mm='nsenter -t1 -m'; fi mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do ui_print "* Un-mount" @@ -34,27 +30,27 @@ mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do done am force-stop "$PKG_NAME" -if ! (pm path "$PKG_NAME" >/dev/null 2>&1 &1 &1 /dev/null; then + if pmex install-existing "$PKG_NAME" >/dev/null; then + ui_print "* Installed existing $PKG_NAME" fi - ui_print "* Installed existing $PKG_NAME" fi -INS=true IS_SYS=false -if BASEPATH=$(pm path "$PKG_NAME" 2>&1 &2 "'$BASEPATH'" BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*} if echo "$BASEPATH" | grep -qF -e '/system/' -e '/product/'; then - ui_print "* $PKG_NAME is a system app" - if [ "${BASEPATH:1:6}" != system ]; then BASEPATH=/system${BASEPATH}; fi + ui_print "* $PKG_NAME is a system app." IS_SYS=true - elif [ ! -d "${BASEPATH}/lib" ]; then - ui_print "* Invalid installation found. Uninstalling..." - if ! op=$(pm uninstall -k --user 0 "$PKG_NAME" 2>&1 &1 &1 &1 &1 "$SCNM" + chmod +x "$SCNM" + ui_print "* Created the uninstall script." + ui_print "" + ui_print "* Reboot and reflash the module!" + abort else ui_print "* Uninstalling..." - if ! op=$(pm uninstall -k --user 0 "$PKG_NAME" 2>&1 &1 &1); then - ui_print "ERROR: Mount failed!" - ui_print "$op" - fi - am force-stop "$PKG_NAME" +ui_print "* Mounting $PKG_NAME" +mkdir -p "/data/adb/rvhc" +RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk +mv -f "$MODPATH/base.apk" "$RVPATH" - ui_print "* Optimizing $PKG_NAME" - nohup cmd package compile --reset "$PKG_NAME" >/dev/null 2>&1 & +if ! op=$(mm mount -o bind "$RVPATH" "$BASEPATH/base.apk" 2>&1); then + ui_print "ERROR: Mount failed!" + ui_print "$op" fi +am force-stop "$PKG_NAME" +ui_print "* Optimizing $PKG_NAME" +nohup cmd package compile --reset "$PKG_NAME" >/dev/null 2>&1 & ui_print "* Cleanup" rm -rf "${MODPATH:?}/bin" "$MODPATH/$PKG_NAME.apk" -if [ -d "/data/adb/modules/zygisk-assistant" ]; then +if [ "$KSU" ] && [ -d "/data/adb/modules/zygisk-assistant" ]; then ui_print "* If you are using zygisk-assistant, you need to" ui_print " give root permissions to $PKG_NAME" fi diff --git a/revanced-magisk/service.sh b/revanced-magisk/service.sh index 09dbcb2c74..6d2cfcb52c 100755 --- a/revanced-magisk/service.sh +++ b/revanced-magisk/service.sh @@ -11,21 +11,21 @@ while [ $svcl = 20 ] do sleep 2; done sleep 5 +if [ $svcl != 0 ]; then + err "app not installed" + exit +fi +BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*} err() { [ ! -f "$MODDIR/err" ] && cp "$MODDIR/module.prop" "$MODDIR/err" sed -i "s/^des.*/description=⚠️ Needs reflash: '${1}'/g" "$MODDIR/module.prop" } -if [ $svcl != 0 ]; then - err "app not installed" - exit -fi -BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*} if [ ! -d "$BASEPATH/lib" ]; then - err "system force-rebooted (fix your ROM)" - exit -fi + ls -Zla "$BASEPATH" >"$MODDIR/log.txt" + ls -Zla "$BASEPATH/lib" >>"$MODDIR/log.txt" +else rm "$MODDIR/log.txt"; fi VERSION=$(dumpsys package "$PKG_NAME" | grep -m1 versionName) VERSION="${VERSION#*=}" if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then err "version mismatch (installed:${VERSION}, module:$PKG_VER)" diff --git a/revanced-magisk/uninstall.sh b/revanced-magisk/uninstall.sh index 7ed3fbe29b..57f75ff29e 100755 --- a/revanced-magisk/uninstall.sh +++ b/revanced-magisk/uninstall.sh @@ -1,6 +1,9 @@ #!/system/bin/sh { MODDIR=${0%/*} - rm "/data/adb/rvhc/${MODDIR##*/}".apk + . "$MODDIR/config" + + rm "/data/adb/rvhc/${MODDIR##*/}.apk" rmdir "/data/adb/rvhc" + rm "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh" } &