Commit 9ad03994 authored by topjohnwu's avatar topjohnwu

Handle disabling

parent 35228f80
...@@ -51,7 +51,7 @@ for RC in init*.rc; do ...@@ -51,7 +51,7 @@ for RC in init*.rc; do
sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $RC sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $RC
cpio_add $RC 750 cpio_add $RC 750
fi fi
if file_contain "selinux.reload_policy"; then if file_contain "selinux.reload_policy" $RC; then
sed -i "/selinux.reload_policy/d" $RC sed -i "/selinux.reload_policy/d" $RC
cpio_add $RC 750 cpio_add $RC 750
fi fi
......
#!/system/bin/sh #!/system/bin/sh
LOGFILE=/cache/magisk.log LOGFILE=/cache/magisk.log
DISABLEFILE=/cache/.disable_magisk
IMG=/data/magisk.img IMG=/data/magisk.img
WHITELIST="/system/bin" WHITELIST="/system/bin"
...@@ -253,6 +254,8 @@ case $1 in ...@@ -253,6 +254,8 @@ case $1 in
# Cleanup legacy stuffs... # Cleanup legacy stuffs...
rm -rf /cache/magisk /cache/magisk_merge /cache/magiskhide.log rm -rf /cache/magisk /cache/magisk_merge /cache/magiskhide.log
[ -f $DISABLEFILE ] && unblock
if [ -d /cache/magisk_mount ]; then if [ -d /cache/magisk_mount ]; then
log_print "* Mounting cache files" log_print "* Mounting cache files"
find /cache/magisk_mount -type f 2>/dev/null | while read ITEM ; do find /cache/magisk_mount -type f 2>/dev/null | while read ITEM ; do
...@@ -323,7 +326,8 @@ case $1 in ...@@ -323,7 +326,8 @@ case $1 in
# Remove empty directories, legacy paths, symlinks, old temporary images # Remove empty directories, legacy paths, symlinks, old temporary images
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
rm -rf $MOUNTPOINT/zzsupersu $MOUNTPOINT/phh $COREDIR/bin $COREDIR/dummy $COREDIR/mirror /data/magisk/*.img /data/busybox 2>/dev/null rm -rf $MOUNTPOINT/zzsupersu $MOUNTPOINT/phh $COREDIR/bin $COREDIR/dummy $COREDIR/mirror \
$COREDIR/busybox /data/magisk/*.img /data/busybox 2>/dev/null
# Remove modules that are labeled to be removed # Remove modules that are labeled to be removed
for MOD in $MOUNTPOINT/* ; do for MOD in $MOUNTPOINT/* ; do
...@@ -356,8 +360,7 @@ case $1 in ...@@ -356,8 +360,7 @@ case $1 in
[ ! -f /sbin/launch_daemonsu.sh ] && sh $COREDIR/su/magisksu.sh [ ! -f /sbin/launch_daemonsu.sh ] && sh $COREDIR/su/magisksu.sh
export PATH=$TOOLPATH:$OLDPATH export PATH=$TOOLPATH:$OLDPATH
# Disable Magic Mount if specified [ -f $DISABLEFILE ] && unblock
[ -f $APPDIR/disable ] && unblock
log_print "* Preparing modules" log_print "* Preparing modules"
...@@ -498,6 +501,10 @@ case $1 in ...@@ -498,6 +501,10 @@ case $1 in
# Version info # Version info
MAGISK_VERSION_STUB MAGISK_VERSION_STUB
log_print "** Magisk late_start service mode running..." log_print "** Magisk late_start service mode running..."
if [ -f $DISABLEFILE ]; then
setprop ro.magisk.disable 1
exit
fi
run_scripts service run_scripts service
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment