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