From 91b6d2852a46f385e2a9e1e5c8136d21c76490d3 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 22 Mar 2020 05:02:03 -0300 Subject: [PATCH] scripts: add nand/mtd support to uninstaller --- scripts/magisk_uninstaller.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/magisk_uninstaller.sh b/scripts/magisk_uninstaller.sh index e7f1071d0..e9d0e3d51 100644 --- a/scripts/magisk_uninstaller.sh +++ b/scripts/magisk_uninstaller.sh @@ -67,6 +67,12 @@ cd $MAGISKBIN CHROMEOS=false ui_print "- Unpacking boot image" +# Dump image for MTD/NAND character device boot partitions +if [ -c $BOOTIMAGE ]; then + nanddump -f boot.img $BOOTIMAGE + BOOTNAND=$BOOTIMAGE + BOOTIMAGE=boot.img +fi ./magiskboot unpack "$BOOTIMAGE" case $? in @@ -79,6 +85,9 @@ case $? in ;; esac +# Restore the original boot partition path +[ "$BOOTNAND" ] && BOOTIMAGE=$BOOTNAND + # Detect boot image state ui_print "- Checking ramdisk status" if [ -e ramdisk.cpio ]; then @@ -142,10 +151,10 @@ fi cd / if $BOOTMODE; then - ui_print "**********************************************" - ui_print "* Magisk Manager will uninstall itself, and *" - ui_print "* the device will reboot after a few seconds *" - ui_print "**********************************************" + ui_print "********************************************" + ui_print " Magisk Manager will uninstall itself, and" + ui_print " the device will reboot after a few seconds" + ui_print "********************************************" (sleep 8; /system/bin/reboot)& else rm -rf /data/user*/*/*magisk* /data/app/*magisk*