From 942c8709817ca69be0e9044f0bafdec3eed6944e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 7 Dec 2017 04:20:27 +0800 Subject: [PATCH] Properly handle KEEPVERITY and HIGHCOMP --- app | 2 +- scripts/boot_patch.sh | 10 +++++++--- scripts/flash_script.sh | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app b/app index 96eaa833f..c461fc6da 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 96eaa833f561e645ba99f87ec9d376fc338b0861 +Subproject commit c461fc6daa7096398f9227a10bcb4cec271cb5e7 diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index b012c5417..f9871baa3 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -88,7 +88,6 @@ case $? in ;; 2 ) ui_print "! Insufficient boot partition size detected" - ui_print "- Enable high compression mode" HIGHCOMP=true ;; 3 ) @@ -104,6 +103,13 @@ case $? in abort "! Stock kernel cannot be patched, please use a custom kernel" esac +if [ -f /sdcard/ramdisk-recovery.img ]; then + HIGHCOMP=true + ui_print "- Detected ramdisk-recovery.img" +fi + +$HIGHCOMP && ui_print "- Enable high compression mode" + ########################################################################################## # Ramdisk restores ########################################################################################## @@ -139,8 +145,6 @@ esac ui_print "- Patching ramdisk" -[ -f /sdcard/ramdisk-recovery.img ] && HIGHCOMP=true - ./magiskboot --cpio-add ramdisk.cpio 750 init magiskinit ./magiskboot --cpio-backup ramdisk.cpio ramdisk.cpio.orig $HIGHCOMP $KEEPVERITY $KEEPFORCEENCRYPT $SHA1 diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 6e87299f8..dd7f26d9e 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -123,7 +123,7 @@ if [ -f stock_boot* ]; then is_mounted /data && mv stock_boot* /data fi -patch_dtbo_image +$KEEPVERITY || patch_dtbo_image if [ -f stock_dtbo* ]; then rm -f /data/stock_dtbo* 2>/dev/null