Handle disabling

This commit is contained in:
topjohnwu 2017-02-05 23:40:50 +08:00
parent 35228f80b8
commit 9ad03994d1
2 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -1,6 +1,7 @@
#!/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
# 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
# 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
[ ! -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
# 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
;; ;;