diff --git a/scripts/addon.d.sh b/scripts/addon.d.sh index 53aa676c4..8aae989b6 100644 --- a/scripts/addon.d.sh +++ b/scripts/addon.d.sh @@ -20,9 +20,8 @@ else fi initialize() { - mount /data 2>/dev/null - MAGISKBIN=/data/adb/magisk + if [ ! -d $MAGISKBIN ]; then echo "! Cannot find Magisk binaries!" exit 1 @@ -46,6 +45,9 @@ main() { sleep 5 fi + # Ensure we aren't in /tmp/addon.d anymore (since it's been deleted by addon.d) + cd $TMPDIR + $BOOTMODE || recovery_actions ui_print "************************" diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index df92b5e48..6b8f6bbcc 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -84,6 +84,8 @@ if [ -d /system/addon.d ]; then #!/sbin/sh # ADDOND_VERSION=2 +mount /data 2>/dev/null + if [ -f /data/adb/magisk/addon.d.sh ]; then exec sh /data/adb/magisk/addon.d.sh "\$@" else diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 8977f28cb..25e5fdfe3 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -295,12 +295,12 @@ patch_dtbo_image() { patch_boot_image() { # Common installation script for flash_script.sh (updater-script) and addon.d.sh - eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true - $BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0" - SOURCEDMODE=true cd $MAGISKBIN + eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true + $BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0" + $IS64BIT && mv -f magiskinit64 magiskinit 2>/dev/null || rm -f magiskinit64 # Source the boot patcher