7698971538
With Magisk, depending on enabled modules, directories like /system/xbin, /system/app and others could be tmpfs, with /system/xbin/su and /system/app/me.phh.superuser being bind-mounts. So we should try to operate on the real system partition.
29 lines
596 B
Bash
29 lines
596 B
Bash
#!/system/bin/sh
|
|
|
|
SYSTEM=/system
|
|
[ -d /sbin/.magisk/mirror/system ] && SYSTEM=/sbin/.magisk/mirror/system
|
|
|
|
for MOUNTPOINT in \
|
|
/sbin/.magisk/mirror/system_root \
|
|
/sbin/.magisk/mirror/system \
|
|
/system \
|
|
/
|
|
do
|
|
[ -d $MOUNTPOINT ] && mountpoint -q $MOUNTPOINT && break
|
|
done
|
|
|
|
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
|
|
rm $SYSTEM/bin/phh-securize.sh
|
|
rm -Rf $SYSTEM/{app,priv-app}/me.phh.superuser/
|
|
rm -Rf /data/su || true
|
|
mount -o remount,ro $MOUNTPOINT
|
|
sync
|
|
reboot
|