Add recommend KEEPVERITY and KEEPFORCEENCRYPT flags
This commit is contained in:
parent
a3c49de6a5
commit
f7b4935677
2
app
2
app
@ -1 +1 @@
|
|||||||
Subproject commit 91337218b314c853ad441aa38947394a68afcb08
|
Subproject commit 2df351d378c0d3f674db43a3b86b59fc23ab5f6a
|
@ -63,9 +63,17 @@ BOOTIMAGE="$1"
|
|||||||
|
|
||||||
# Presets
|
# Presets
|
||||||
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
[ -z $KEEPVERITY ] && KEEPVERITY=false
|
||||||
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
|
|
||||||
[ -z $HIGHCOMP ] && HIGHCOMP=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 .
|
chmod -R 755 .
|
||||||
|
|
||||||
# Extract magisk if doesn't exist
|
# Extract magisk if doesn't exist
|
||||||
@ -113,7 +121,7 @@ ui_print "- Checking ramdisk status"
|
|||||||
./magiskboot --cpio ramdisk.cpio test
|
./magiskboot --cpio ramdisk.cpio test
|
||||||
case $? in
|
case $? in
|
||||||
0 ) # Stock boot
|
0 ) # Stock boot
|
||||||
ui_print "- Stock boot image detected!"
|
ui_print "- Stock boot image detected"
|
||||||
ui_print "- Backing up stock boot image"
|
ui_print "- Backing up stock boot image"
|
||||||
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null`
|
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null`
|
||||||
STOCKDUMP=stock_boot_${SHA1}.img.gz
|
STOCKDUMP=stock_boot_${SHA1}.img.gz
|
||||||
@ -121,14 +129,14 @@ case $? in
|
|||||||
cp -af ramdisk.cpio ramdisk.cpio.orig
|
cp -af ramdisk.cpio ramdisk.cpio.orig
|
||||||
;;
|
;;
|
||||||
1 ) # Magisk patched
|
1 ) # Magisk patched
|
||||||
ui_print "- Magisk patched image detected!"
|
ui_print "- Magisk patched image detected"
|
||||||
# Find SHA1 of stock boot image
|
# Find SHA1 of stock boot image
|
||||||
[ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null`
|
[ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null`
|
||||||
./magiskboot --cpio ramdisk.cpio restore
|
./magiskboot --cpio ramdisk.cpio restore
|
||||||
cp -af ramdisk.cpio ramdisk.cpio.orig
|
cp -af ramdisk.cpio ramdisk.cpio.orig
|
||||||
;;
|
;;
|
||||||
2 ) # Other patched
|
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"
|
abort "! Please restore stock boot image"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -113,6 +113,13 @@ $BOOTMODE || recovery_actions
|
|||||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||||
ui_print "- Found boot image: $BOOTIMAGE"
|
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
|
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
|
||||||
$BOOTSIGNED && ui_print "- Signed boot image detected"
|
$BOOTSIGNED && ui_print "- Signed boot image detected"
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@ ui_print "- Checking ramdisk status"
|
|||||||
./magiskboot --cpio ramdisk.cpio test
|
./magiskboot --cpio ramdisk.cpio test
|
||||||
case $? in
|
case $? in
|
||||||
0 ) # Stock boot
|
0 ) # Stock boot
|
||||||
ui_print "- Stock boot image detected!"
|
ui_print "- Stock boot image detected"
|
||||||
abort "! Magisk is not installed!"
|
abort "! Magisk is not installed!"
|
||||||
;;
|
;;
|
||||||
1 ) # Magisk patched
|
1 ) # Magisk patched
|
||||||
ui_print "- Magisk patched image detected!"
|
ui_print "- Magisk patched image detected"
|
||||||
# Find SHA1 of stock boot image
|
# Find SHA1 of stock boot image
|
||||||
[ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null`
|
[ -z $SHA1 ] && SHA1=`./magiskboot --cpio ramdisk.cpio sha1 2>/dev/null`
|
||||||
OK=false
|
OK=false
|
||||||
@ -94,7 +94,7 @@ case $? in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2 ) # Other patched
|
2 ) # Other patched
|
||||||
ui_print "! Boot image patched by other programs!"
|
ui_print "! Boot image patched by other programs"
|
||||||
abort "! Cannot uninstall"
|
abort "! Cannot uninstall"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -133,6 +133,7 @@ migrate_boot_backup() {
|
|||||||
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
||||||
fi
|
fi
|
||||||
mv /data/magisk/stock_boot* /data 2>/dev/null
|
mv /data/magisk/stock_boot* /data 2>/dev/null
|
||||||
|
mv /data/magisk/adb/stock_boot* /data 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
flash_boot_image() {
|
flash_boot_image() {
|
||||||
@ -161,9 +162,7 @@ find_dtbo_image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patch_dtbo_image() {
|
patch_dtbo_image() {
|
||||||
find_dtbo_image
|
|
||||||
if [ ! -z $DTBOIMAGE ]; then
|
if [ ! -z $DTBOIMAGE ]; then
|
||||||
ui_print "- Found dtbo image: $DTBOIMAGE"
|
|
||||||
if $MAGISKBIN/magiskboot --dtb-test $DTBOIMAGE; then
|
if $MAGISKBIN/magiskboot --dtb-test $DTBOIMAGE; then
|
||||||
ui_print "- Backing up stock dtbo image"
|
ui_print "- Backing up stock dtbo image"
|
||||||
$MAGISKBIN/magiskboot --compress $DTBOIMAGE $MAGISKBIN/stock_dtbo.img.gz
|
$MAGISKBIN/magiskboot --compress $DTBOIMAGE $MAGISKBIN/stock_dtbo.img.gz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user