diff --git a/revanced-magisk/customize.sh b/revanced-magisk/customize.sh index ad2d7257ee..9344ff9c43 100755 --- a/revanced-magisk/customize.sh +++ b/revanced-magisk/customize.sh @@ -7,21 +7,18 @@ Your device: $ARCH Module: $MODULE_ARCH" fi +alias cmpr="$MODPATH/bin/$ARCH/cmpr" if [ "$ARCH" = "arm" ]; then ARCH_LIB=armeabi-v7a - alias cmpr='$MODPATH/bin/arm/cmpr' elif [ "$ARCH" = "arm64" ]; then ARCH_LIB=arm64-v8a - alias cmpr='$MODPATH/bin/arm64/cmpr' elif [ "$ARCH" = "x86" ]; then ARCH_LIB=x86 - alias cmpr='$MODPATH/bin/x86/cmpr' elif [ "$ARCH" = "x64" ]; then ARCH_LIB=x86_64 - alias cmpr='$MODPATH/bin/x64/cmpr' -else - abort "ERROR: unsupported arch: ${ARCH}" -fi +else abort "ERROR: unreachable: ${ARCH}"; fi +RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk + set_perm_recursive "$MODPATH/bin" 0 0 0755 0777 if su -M -c true >/dev/null 2>/dev/null; then @@ -30,21 +27,34 @@ else alias mm='nsenter -t1 -m' fi -mm grep "$PKG_NAME" /proc/mounts | while read -r line; do +mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do ui_print "* Un-mount" mp=${line#* } mp=${mp%% *} mm umount -l "${mp%%\\*}" done am force-stop "$PKG_NAME" +if ! (pm path "$PKG_NAME" >/dev/null 2>&1 &1 &1 &1 &1); then - ui_print "ERROR: install-create failed" - abort "$SES" - fi - SES=${SES#*[} SES=${SES%]*} - set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0 - if ! op=$(pm install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk" 2>&1); then - ui_print "ERROR: install-write failed" - abort "$op" - fi - if ! op=$(pm install-commit "$SES" 2>&1); then - if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then - ui_print "* INSTALL_FAILED_VERSION_DOWNGRADE. Uninstalling..." - pm uninstall -k --user 0 "$PKG_NAME" - return 1 + + while true; do + if ! SES=$(pm install-create --user 0 -i com.android.vending -r -d -S "$SZ" 2>&1 &1 &1 &1 &1 &1 &1); then + ui_print "ERROR: Mount failed!" + ui_print "$op" + fi + am force-stop "$PKG_NAME" -if ! op=$(mm mount -o bind "$RVPATH" "$BASEPATH/base.apk" 2>&1); then - ui_print "ERROR: Mount failed!" - ui_print "$op" + ui_print "* Optimizing $PKG_NAME" + nohup cmd package compile --reset "$PKG_NAME" >/dev/null 2>&1 & 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 + ui_print "* If you are using zygisk-assistant, you need to" + ui_print " give root permissions to $PKG_NAME" +fi + ui_print "* Done" ui_print " by j-hc (github.com/j-hc)" ui_print " " diff --git a/revanced-magisk/service.sh b/revanced-magisk/service.sh index fdfac8ea6c..09dbcb2c74 100755 --- a/revanced-magisk/service.sh +++ b/revanced-magisk/service.sh @@ -23,7 +23,7 @@ if [ $svcl != 0 ]; then fi BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*} if [ ! -d "$BASEPATH/lib" ]; then - err "zygote crashed (fix your ROM)" + err "system force-rebooted (fix your ROM)" exit fi VERSION=$(dumpsys package "$PKG_NAME" | grep -m1 versionName) VERSION="${VERSION#*=}"