Update uninstaller
This commit is contained in:
parent
83af0497e4
commit
98e21f9f5b
@ -36,8 +36,6 @@ if $BOOTMODE; then
|
||||
. $MAGISKBIN/util_functions.sh
|
||||
boot_actions
|
||||
mount_partitions
|
||||
else
|
||||
recovery_actions
|
||||
fi
|
||||
|
||||
cd $MAGISKBIN
|
||||
@ -81,15 +79,17 @@ case $? in
|
||||
ui_print "- Magisk patched image detected!"
|
||||
# Find SHA1 of stock boot image
|
||||
[ -z $SHA1 ] && SHA1=`./magiskboot --cpio-stocksha1 ramdisk.cpio 2>/dev/null`
|
||||
[ ! -z $SHA1 ] && STOCKDUMP=/data/stock_boot_${SHA1}.img
|
||||
if [ -f ${STOCKDUMP}.gz ]; then
|
||||
[ ! -z $SHA1 ] && STOCKBOOT=/data/stock_boot_${SHA1}.img.gz
|
||||
if [ -f "$STOCKBOOT" ]; then
|
||||
ui_print "- Boot image backup found!"
|
||||
./magiskboot --decompress ${STOCKDUMP}.gz new-boot.img
|
||||
else
|
||||
ui_print "! Boot image backup unavailable"
|
||||
ui_print "- Restoring ramdisk with internal backup"
|
||||
./magiskboot --cpio-restore ramdisk.cpio
|
||||
./magiskboot --repack $BOOTIMAGE new-boot.img
|
||||
./magiskboot --repack $BOOTIMAGE
|
||||
# Sign chromeos boot
|
||||
$CHROMEOS && sign_chromeos
|
||||
STOCKBOOT=new-boot.img
|
||||
fi
|
||||
;;
|
||||
2 ) # Other patched
|
||||
@ -98,24 +98,13 @@ case $? in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Sign chromeos boot
|
||||
$CHROMEOS && sign_chromeos
|
||||
|
||||
ui_print "- Flashing stock/reverted image"
|
||||
if [ -L "$BOOTIMAGE" ]; then
|
||||
dd if=new-boot.img of="$BOOTIMAGE" bs=4096
|
||||
else
|
||||
cat new-boot.img /dev/zero | dd of="$BOOTIMAGE" bs=4096 >/dev/null 2>&1
|
||||
fi
|
||||
rm -f new-boot.img
|
||||
flash_boot_image $STOCKBOOT "$BOOTIMAGE"
|
||||
|
||||
cd /
|
||||
|
||||
ui_print "- Removing Magisk files"
|
||||
rm -rf /cache/magisk.log /cache/last_magisk.log /cache/magiskhide.log /cache/.disable_magisk \
|
||||
/cache/magisk /cache/magisk_merge /cache/magisk_mount /cache/unblock /cache/magisk_uninstaller.sh \
|
||||
/data/Magisk.apk /data/magisk.apk /data/magisk.img /data/magisk_merge.img /data/magisk_debug.log \
|
||||
/data/busybox /data/magisk /data/custom_ramdisk_patch.sh /data/property/*magisk* \
|
||||
rm -rf /cache/*magisk* /cache/unblock /data/*magisk* /data/cache/*magisk* /data/property/*magisk* \
|
||||
/data/Magisk.apk /data/busybox /data/custom_ramdisk_patch.sh \
|
||||
/data/app/com.topjohnwu.magisk* /data/user*/*/com.topjohnwu.magisk 2>/dev/null
|
||||
|
||||
$BOOTMODE && reboot || recovery_cleanup
|
||||
$BOOTMODE && reboot
|
||||
|
@ -40,7 +40,8 @@ ui_print "************************"
|
||||
ui_print " Magisk Uninstaller "
|
||||
ui_print "************************"
|
||||
|
||||
is_mounted /data || mount /data
|
||||
is_mounted /data || mount /data || abort "! Unable to mount partitions"
|
||||
is_mounted /cache || mount /cache 2>/dev/null
|
||||
mount_partitions
|
||||
|
||||
api_level_arch_detect
|
||||
@ -56,21 +57,22 @@ BINDIR=$INSTALLER/$ARCH
|
||||
MAGISKBIN=/data/magisk
|
||||
|
||||
if is_mounted /data; then
|
||||
recovery_actions
|
||||
# Save our stock boot image dump before removing it
|
||||
[ -f $MAGISKBIN/stock_boot* ] && mv $MAGISKBIN/stock_boot* /data
|
||||
mv $MAGISKBIN/stock_boot* /data 2>/dev/null
|
||||
# Copy the binaries to /data/magisk, in case they do not exist
|
||||
rm -rf $MAGISKBIN 2>/dev/null
|
||||
mkdir -p $MAGISKBIN
|
||||
cp -af $BINDIR/. $CHROMEDIR $TMPDIR/bin/busybox $INSTALLER/util_functions.sh $MAGISKBIN
|
||||
chmod -R 755 $MAGISKBIN
|
||||
# Run the acttual uninstallation
|
||||
# Run the actual uninstallation
|
||||
. $INSTALLER/magisk_uninstaller.sh
|
||||
recovery_cleanup
|
||||
else
|
||||
ui_print "! Data unavailable"
|
||||
ui_print "! Placing uninstall script to /cache"
|
||||
ui_print "! The device might reboot multiple times"
|
||||
cp -af $INSTALLER/magisk_uninstaller.sh /cache/magisk_uninstaller.sh
|
||||
umount /system
|
||||
ui_print "- Rebooting....."
|
||||
sleep 5
|
||||
reboot
|
||||
|
Loading…
Reference in New Issue
Block a user