Merge pull request #270 from hwti/patch-2

Make phh-securize.sh work with current Magisk
This commit is contained in:
Pierre-Hugues HUSSON 2021-08-09 20:14:12 +02:00 committed by GitHub
commit 5beb9d0966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,22 @@
#!/system/bin/sh #!/system/bin/sh
SYSTEM=/system if [ -e /system/bin/magisk ]
[ -d /sbin/.magisk/mirror/system ] && SYSTEM=/sbin/.magisk/mirror/system 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 \ # remove bind-mount of phh-su (preventing $SYSTEM/xbin/su to be removed)
/sbin/.magisk/mirror/system_root \ umount -l /system/xbin/su
/sbin/.magisk/mirror/system \
/system \ for MOUNTPOINT in $MOUNTPOINT_LIST
/
do do
[ -d $MOUNTPOINT ] && mountpoint -q $MOUNTPOINT && break [ -d $MOUNTPOINT ] && mountpoint -q $MOUNTPOINT && break
done done
@ -16,7 +25,6 @@ mount -o remount,rw $MOUNTPOINT
remount remount
touch $SYSTEM/phh/secure touch $SYSTEM/phh/secure
umount -l $SYSTEM/xbin/su
rm $SYSTEM/xbin/su rm $SYSTEM/xbin/su
rm $SYSTEM/bin/phh-su rm $SYSTEM/bin/phh-su
rm $SYSTEM/etc/init/su.rc rm $SYSTEM/etc/init/su.rc