From b0ddecfc397d919f2972348dd31ea77fad61dd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Yhuel?= Date: Mon, 9 Aug 2021 05:01:46 +0200 Subject: [PATCH] Make phh-securize.sh work with current Magisk Magisk 21.0 changed the mount path, we have to get it with "magisk --path" now. This is used to get where the system partition is mounted. The phh-su bind-mount is on /system/xbin/su, even with Magisk. But we still have to unmount it, in order to remove the empty "su" file on the system partition. --- phh-securize.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/phh-securize.sh b/phh-securize.sh index ad7e64e..0b361b5 100644 --- a/phh-securize.sh +++ b/phh-securize.sh @@ -1,13 +1,22 @@ #!/system/bin/sh -SYSTEM=/system -[ -d /sbin/.magisk/mirror/system ] && SYSTEM=/sbin/.magisk/mirror/system +if [ -e /system/bin/magisk ] +then + # remove bind-mount of phh-su overriding /system/bin/su -> ./magisk + umount -l /system/bin/magisk + # we need to modify the real system partition + MAGISK_MIRROR="$(magisk --path)/.magisk/mirror" + SYSTEM=$MAGISK_MIRROR/system + MOUNTPOINT_LIST="$MAGISK_MIRROR/system_root $MAGISK_MIRROR/system" +else + SYSTEM=/system + MOUNTPOINT_LIST="/system /" +fi -for MOUNTPOINT in \ - /sbin/.magisk/mirror/system_root \ - /sbin/.magisk/mirror/system \ - /system \ - / +# remove bind-mount of phh-su (preventing $SYSTEM/xbin/su to be removed) +umount -l /system/xbin/su + +for MOUNTPOINT in $MOUNTPOINT_LIST do [ -d $MOUNTPOINT ] && mountpoint -q $MOUNTPOINT && break done @@ -16,7 +25,6 @@ mount -o remount,rw $MOUNTPOINT remount touch $SYSTEM/phh/secure -umount -l $SYSTEM/xbin/su rm $SYSTEM/xbin/su rm $SYSTEM/bin/phh-su rm $SYSTEM/etc/init/su.rc