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