From d9bce45db42a36933cce0ef6943580498bf8e2ed Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 5 Feb 2017 00:37:30 +0800 Subject: [PATCH] Fix props not loading correctly --- scripts/flash_script.sh | 8 ++------ scripts/init.magisk.rc | 12 +----------- scripts/magic_mask.sh | 27 ++++++++++++--------------- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index b3b78cfeb..1500ca303 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -503,11 +503,7 @@ else [ ! -f .backup/$RC ] && cp -af $RC .backup sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $RC fi - if file_contain "trigger load_persist_props_action" $RC && ! file_contain "trigger load_magisk_props_action" $RC; then - [ ! -f .backup/$RC ] && cp -af $RC .backup - sed -i "/trigger load_persist_props_action/a\ \ \ \ trigger load_magisk_props_action" $RC - fi - if file_contain "selinux.reload_policy"; then + if file_contain "selinux.reload_policy" $RC; then [ ! -f .backup/$RC ] && cp -af $RC .backup sed -i "/selinux.reload_policy/d" $RC fi @@ -517,7 +513,7 @@ else [ -L $FSTAB ] && continue if (! $KEEPVERITY); then sed -i "s/,support_scfs//g" $FSTAB - sed -i 's;,\{0,1\}verify\(=[^,]*\)\{0,1\};;g' $FSTAB + sed -i 's/,\{0,1\}verify\(=[^,]*\)\{0,1\}//g' $FSTAB fi if (! $KEEPFORCEENCRYPT); then sed -i "s/forceencrypt/encryptable/g" $FSTAB diff --git a/scripts/init.magisk.rc b/scripts/init.magisk.rc index 16791fd21..443b428b8 100644 --- a/scripts/init.magisk.rc +++ b/scripts/init.magisk.rc @@ -6,15 +6,11 @@ on post-fs rm /dev/.magisk.unblock on post-fs-data + load_persist_props start magisk_pfsd wait /dev/.magisk.unblock 60 rm /dev/.magisk.unblock -on load_magisk_props_action - start magisk_props - wait /dev/.magisk.unblock 5 - rm /dev/.magisk.unblock - on property:magisk.restart_pfsd=1 trigger post-fs-data @@ -32,12 +28,6 @@ service magisk_pfsd /sbin/magic_mask.sh post-fs-data seclabel u:r:su:s0 oneshot -# Load module props -service magisk_props /sbin/magic_mask.sh load_magisk_props - user root - seclabel u:r:su:s0 - oneshot - # launch late_start script service magisk_service /sbin/magic_mask.sh service class late_start diff --git a/scripts/magic_mask.sh b/scripts/magic_mask.sh index 0fc38689e..6eb4c0b62 100644 --- a/scripts/magic_mask.sh +++ b/scripts/magic_mask.sh @@ -49,6 +49,7 @@ in_list() { unblock() { touch /dev/.magisk.unblock + chcon u:object_r:device:s0 /dev/.magisk.unblock exit } @@ -465,6 +466,17 @@ case $1 in rm -f /data/magisk.apk 2>/dev/null fi + for MOD in $MOUNTPOINT/* ; do + # Read in defined system props + if [ -f $MOD/system.prop ]; then + log_print "* Reading props from $MOD/system.prop" + /data/magisk/resetprop --file $MOD/system.prop + fi + done + + # Expose busybox + [ "`getprop persist.magisk.busybox`" = "1" ] && sh /sbin/magic_mask.sh mount_busybox + # Restart post-fs-data if necessary (multirom) $MULTIROM && setprop magisk.restart_pfsd 1 @@ -472,21 +484,6 @@ case $1 in unblock ;; - load_magisk_props ) - for MOD in $MOUNTPOINT/* ; do - # Read in defined system props - if [ -f $MOD/system.prop ]; then - log_print "* Reading props from $MOD/system.prop" - /data/magisk/resetprop --file $MOD/system.prop - fi - done - - # Expose busybox - [ "`getprop persist.magisk.busybox`" = "1" ] && sh /sbin/magic_mask.sh mount_busybox - - unblock - ;; - mount_busybox ) log_print "* Enabling BusyBox" cp -afc /system/xbin/. $TOOLPATH