Fix uninstaller missing recent changes
- group unsupported formats into the same code (86f778c0aa (diff-93690a8d9f50c177ef97416af3be8726)
) - support A only system-as-root devices (e72c6685ed (diff-93690a8d9f50c177ef97416af3be8726)
) - remove unnecessary '--' from magiskboot actions (7f08c06943 (diff-93690a8d9f50c177ef97416af3be8726)
) - get_flags need to be before find_boot_image (a4f5d47e72
) closes #1371, closes #1431, closes #1439
This commit is contained in:
parent
a9350f50c9
commit
ac28e6e5ca
@ -55,6 +55,7 @@ restore_imgs() {
|
|||||||
local STOCKDTBO=/data/stock_dtbo.img.gz
|
local STOCKDTBO=/data/stock_dtbo.img.gz
|
||||||
[ -f $STOCKBOOT ] || return 1
|
[ -f $STOCKBOOT ] || return 1
|
||||||
|
|
||||||
|
get_flags
|
||||||
find_boot_image
|
find_boot_image
|
||||||
find_dtbo_image
|
find_dtbo_image
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ $BOOTMODE || recovery_actions
|
|||||||
# Uninstall
|
# Uninstall
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
|
get_flags
|
||||||
find_boot_image
|
find_boot_image
|
||||||
find_dtbo_image
|
find_dtbo_image
|
||||||
|
|
||||||
@ -67,36 +68,35 @@ cd $MAGISKBIN
|
|||||||
CHROMEOS=false
|
CHROMEOS=false
|
||||||
|
|
||||||
ui_print "- Unpacking boot image"
|
ui_print "- Unpacking boot image"
|
||||||
./magiskboot --unpack "$BOOTIMAGE"
|
./magiskboot unpack "$BOOTIMAGE"
|
||||||
|
|
||||||
case $? in
|
case $? in
|
||||||
1 )
|
1 )
|
||||||
abort "! Unable to unpack boot image"
|
abort "! Unsupported/Unknown image format"
|
||||||
;;
|
;;
|
||||||
2 )
|
2 )
|
||||||
ui_print "- ChromeOS boot image detected"
|
ui_print "- ChromeOS boot image detected"
|
||||||
CHROMEOS=true
|
CHROMEOS=true
|
||||||
;;
|
;;
|
||||||
3 )
|
|
||||||
ui_print "! Sony ELF32 format detected"
|
|
||||||
abort "! Please use BootBridge from @AdrianDC"
|
|
||||||
;;
|
|
||||||
4 )
|
|
||||||
ui_print "! Sony ELF64 format detected"
|
|
||||||
abort "! Stock kernel cannot be patched, please use a custom kernel"
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Detect boot image state
|
# Detect boot image state
|
||||||
ui_print "- Checking ramdisk status"
|
ui_print "- Checking ramdisk status"
|
||||||
./magiskboot --cpio ramdisk.cpio test
|
if [ -e ramdisk.cpio ]; then
|
||||||
case $? in
|
./magiskboot cpio ramdisk.cpio test
|
||||||
|
STATUS=$?
|
||||||
|
else
|
||||||
|
# Stock A only system-as-root
|
||||||
|
STATUS=0
|
||||||
|
fi
|
||||||
|
case $((STATUS & 3)) in
|
||||||
0 ) # Stock boot
|
0 ) # Stock boot
|
||||||
ui_print "- Stock boot image detected"
|
ui_print "- Stock boot image detected"
|
||||||
;;
|
;;
|
||||||
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`
|
||||||
STOCKBOOT=/data/stock_boot_${SHA1}.img.gz
|
STOCKBOOT=/data/stock_boot_${SHA1}.img.gz
|
||||||
STOCKDTBO=/data/stock_dtbo.img.gz
|
STOCKDTBO=/data/stock_dtbo.img.gz
|
||||||
if [ -f $STOCKBOOT ]; then
|
if [ -f $STOCKBOOT ]; then
|
||||||
@ -109,16 +109,20 @@ case $? in
|
|||||||
else
|
else
|
||||||
ui_print "! Boot image backup unavailable"
|
ui_print "! Boot image backup unavailable"
|
||||||
ui_print "- Restoring ramdisk with internal backup"
|
ui_print "- Restoring ramdisk with internal backup"
|
||||||
./magiskboot --cpio ramdisk.cpio restore
|
./magiskboot cpio ramdisk.cpio restore
|
||||||
./magiskboot --repack $BOOTIMAGE
|
if ! ./magiskboot cpio ramdisk.cpio "exists init.rc"; then
|
||||||
|
# A only system-as-root
|
||||||
|
rm -f ramdisk.cpio
|
||||||
|
fi
|
||||||
|
./magiskboot repack $BOOTIMAGE
|
||||||
# Sign chromeos boot
|
# Sign chromeos boot
|
||||||
$CHROMEOS && sign_chromeos
|
$CHROMEOS && sign_chromeos
|
||||||
ui_print "- Flashing restored boot image"
|
ui_print "- Flashing restored boot image"
|
||||||
flash_image new-boot.img $BOOTIMAGE || abort "! Insufficient partition size"
|
flash_image new-boot.img $BOOTIMAGE || abort "! Insufficient partition size"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2 ) # Other patched
|
2 ) # Unsupported
|
||||||
ui_print "! Boot image patched by other programs"
|
ui_print "! Boot image patched by unsupported programs"
|
||||||
abort "! Cannot uninstall"
|
abort "! Cannot uninstall"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user