mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Fix uninstaller
This commit is contained in:
parent
e579f314a6
commit
c8216f9bc5
@ -76,14 +76,7 @@ remove_system_su
|
||||
|
||||
ui_print "- Constructing environment"
|
||||
|
||||
DATA=false
|
||||
DATA_DE=false
|
||||
if grep ' /data ' /proc/mounts | grep -vq 'tmpfs'; then
|
||||
# Test if data is writable
|
||||
touch /data/.rw && rm /data/.rw && DATA=true
|
||||
# Test if DE storage is writable
|
||||
$DATA && [ -d /data/adb ] && touch /data/adb/.rw && rm /data/adb/.rw && DATA_DE=true
|
||||
fi
|
||||
check_data
|
||||
|
||||
if $DATA; then
|
||||
MAGISKBIN=/data/magisk
|
||||
|
@ -36,17 +36,23 @@ if $BOOTMODE; then
|
||||
. $MAGISKBIN/util_functions.sh
|
||||
BOOTMODE=true
|
||||
boot_actions
|
||||
mount_partitions
|
||||
fi
|
||||
|
||||
mount_partitions
|
||||
|
||||
find_boot_image
|
||||
find_dtbo_image
|
||||
|
||||
[ -e $BOOTIMAGE ] || abort "! Unable to detect boot image"
|
||||
ui_print "- Found boot/ramdisk image: $BOOTIMAGE"
|
||||
[ -z $DTBOIMAGE ] || ui_print "- Found dtbo image: $DTBOIMAGE"
|
||||
|
||||
cd $MAGISKBIN
|
||||
|
||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||
ui_print "- Found Boot Image: $BOOTIMAGE"
|
||||
CHROMEOS=false
|
||||
|
||||
ui_print "- Unpacking boot image"
|
||||
./magiskboot --unpack "$BOOTIMAGE"
|
||||
CHROMEOS=false
|
||||
|
||||
case $? in
|
||||
1 )
|
||||
@ -71,7 +77,6 @@ ui_print "- Checking ramdisk status"
|
||||
case $? in
|
||||
0 ) # Stock boot
|
||||
ui_print "- Stock boot image detected"
|
||||
abort "! Magisk is not installed!"
|
||||
;;
|
||||
1|2 ) # Magisk patched
|
||||
ui_print "- Magisk patched image detected"
|
||||
@ -103,4 +108,9 @@ rm -rf /cache/*magisk* /cache/unblock /data/*magisk* /data/cache/*magisk* /data
|
||||
/data/user*/*/magisk.db /data/user*/*/com.topjohnwu.magisk /data/user*/*/.tmp.magisk.config \
|
||||
/data/adb/*magisk* 2>/dev/null
|
||||
|
||||
if [ -f /system/addon.d/99-magisk.sh ]; then
|
||||
mount -o rw,remount /system
|
||||
rm -f /system/addon.d/99-magisk.sh
|
||||
fi
|
||||
|
||||
$BOOTMODE && /system/bin/reboot
|
||||
|
@ -12,11 +12,12 @@
|
||||
# Preparation
|
||||
##########################################################################################
|
||||
|
||||
BOOTMODE=false
|
||||
# This path should work in any cases
|
||||
TMPDIR=/dev/tmp
|
||||
|
||||
INSTALLER=$TMPDIR/install
|
||||
CHROMEDIR=$INSTALLER/chromeos
|
||||
|
||||
# Default permissions
|
||||
umask 022
|
||||
|
||||
@ -30,6 +31,7 @@ fi
|
||||
|
||||
# Load utility functions
|
||||
. $INSTALLER/util_functions.sh
|
||||
|
||||
get_outfd
|
||||
|
||||
##########################################################################################
|
||||
@ -42,23 +44,23 @@ ui_print "************************"
|
||||
|
||||
is_mounted /data || mount /data || abort "! Unable to mount partitions"
|
||||
is_mounted /cache || mount /cache 2>/dev/null
|
||||
mount_partitions
|
||||
|
||||
api_level_arch_detect
|
||||
|
||||
ui_print "- Device platform: $ARCH"
|
||||
CHROMEDIR=$INSTALLER/chromeos
|
||||
BINDIR=$INSTALLER/$ARCH32
|
||||
chmod -R 755 $CHROMEDIR $BINDIR
|
||||
|
||||
##########################################################################################
|
||||
# Detection all done, start installing
|
||||
##########################################################################################
|
||||
|
||||
if is_mounted /data; then
|
||||
check_data
|
||||
|
||||
if $DATA_DE; then
|
||||
recovery_actions
|
||||
# Save our stock boot image dump before removing it
|
||||
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
|
||||
|
@ -295,6 +295,17 @@ api_level_arch_detect() {
|
||||
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; ARCH32=x86; IS64BIT=true; fi;
|
||||
}
|
||||
|
||||
check_data() {
|
||||
DATA=false
|
||||
DATA_DE=false
|
||||
if grep ' /data ' /proc/mounts | grep -vq 'tmpfs'; then
|
||||
# Test if data is writable
|
||||
touch /data/.rw && rm /data/.rw && DATA=true
|
||||
# Test if DE storage is writable
|
||||
$DATA && [ -d /data/adb ] && touch /data/adb/.rw && rm /data/adb/.rw && DATA_DE=true
|
||||
fi
|
||||
}
|
||||
|
||||
setup_bb() {
|
||||
if [ -x /sbin/.core/busybox/busybox ]; then
|
||||
# Make sure this path is in the front
|
||||
|
Loading…
Reference in New Issue
Block a user