diff --git a/app b/app index 91337218b..2df351d37 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 91337218b314c853ad441aa38947394a68afcb08 +Subproject commit 2df351d378c0d3f674db43a3b86b59fc23ab5f6a diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index 8198d2f6e..150fd36bf 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -63,9 +63,17 @@ BOOTIMAGE="$1" # Presets [ -z $KEEPVERITY ] && KEEPVERITY=false -[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false [ -z $HIGHCOMP ] && HIGHCOMP=false +if [ -z $KEEPFORCEENCRYPT ]; then + if [ "`getprop ro.crypto.state`" = "encrypted" ]; then + KEEPFORCEENCRYPT=true + ui_print "- Encrypted data detected" + else + KEEPFORCEENCRYPT=false + fi +fi + chmod -R 755 . # Extract magisk if doesn't exist @@ -113,7 +121,7 @@ ui_print "- Checking ramdisk status" ./magiskboot --cpio ramdisk.cpio test case $? in 0 ) # Stock boot - ui_print "- Stock boot image detected!" + ui_print "- Stock boot image detected" ui_print "- Backing up stock boot image" SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null` STOCKDUMP=stock_boot_${SHA1}.img.gz @@ -121,14 +129,14 @@ case $? in cp -af ramdisk.cpio ramdisk.cpio.orig ;; 1 ) # Magisk patched - ui_print "- Magisk patched image detected!" + ui_print "- Magisk patched image detected" # Find SHA1 of stock boot image [ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null` ./magiskboot --cpio ramdisk.cpio restore cp -af ramdisk.cpio ramdisk.cpio.orig ;; 2 ) # Other patched - ui_print "! Boot image patched by other programs!" + ui_print "! Boot image patched by other programs" abort "! Please restore stock boot image" ;; esac diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 005dc1148..47a3a83e3 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -113,6 +113,13 @@ $BOOTMODE || recovery_actions [ -z $BOOTIMAGE ] && abort "! Unable to detect boot image" ui_print "- Found boot image: $BOOTIMAGE" +find_dtbo_image +if [ ! -z $DTBOIMAGE ]; then + ui_print "- Found dtbo image: $DTBOIMAGE" + # Disable dtbo patch by default + [ -z $KEEPVERITY ] && KEEPVERITY=true +fi + eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true $BOOTSIGNED && ui_print "- Signed boot image detected" diff --git a/scripts/magisk_uninstaller.sh b/scripts/magisk_uninstaller.sh index 6f75c4707..728bf9836 100644 --- a/scripts/magisk_uninstaller.sh +++ b/scripts/magisk_uninstaller.sh @@ -74,11 +74,11 @@ ui_print "- Checking ramdisk status" ./magiskboot --cpio ramdisk.cpio test case $? in 0 ) # Stock boot - ui_print "- Stock boot image detected!" + ui_print "- Stock boot image detected" abort "! Magisk is not installed!" ;; 1 ) # Magisk patched - ui_print "- Magisk patched image detected!" + ui_print "- Magisk patched image detected" # Find SHA1 of stock boot image [ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null` OK=false @@ -94,7 +94,7 @@ case $? in fi ;; 2 ) # Other patched - ui_print "! Boot image patched by other programs!" + ui_print "! Boot image patched by other programs" abort "! Cannot uninstall" ;; esac diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 34e126352..88bb1a0de 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -133,6 +133,7 @@ migrate_boot_backup() { $MAGISKBIN/magiskboot --compress $STOCKDUMP fi mv /data/magisk/stock_boot* /data 2>/dev/null + mv /data/magisk/adb/stock_boot* /data 2>/dev/null } flash_boot_image() { @@ -161,9 +162,7 @@ find_dtbo_image() { } patch_dtbo_image() { - find_dtbo_image if [ ! -z $DTBOIMAGE ]; then - ui_print "- Found dtbo image: $DTBOIMAGE" if $MAGISKBIN/magiskboot --dtb-test $DTBOIMAGE; then ui_print "- Backing up stock dtbo image" $MAGISKBIN/magiskboot --compress $DTBOIMAGE $MAGISKBIN/stock_dtbo.img.gz