From c5900e2bbbf10aea46193ba2d6be9443c30f3bcd Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:22:37 +0800 Subject: [PATCH] scripts: handle mode 1 restoration on legacy susfs since we can't do kstat spoof anymore due to https://gitlab.com/simonpunk/susfs4ksu/-/commit/3bdce5608395dd1c7dffcdee89d416e3b88375fc while mode 8 is good and all for legacy susfs, it is still preferrable to use mode 1. this handles it conditionally. basically if 153 or newer, no more kstat spoofing is needed. for 152 and older, kstat spoofing is still needed on some setups weirdly enough. --- module/post-fs-data.sh | 4 ++-- module/service.sh | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index a024bbd..40251ca 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -36,9 +36,9 @@ if [ "$KSU" = true ] && [ -f ${SUSFS_BIN} ] ; then mode=1 else # theres no other way to probe for legacy susfs - dmesg | grep -q "susfs" > /dev/null && { + dmesg | grep -q "susfs" > /dev/null 2>&1 && { echo "bindhosts: post-fs-data.sh - legacy susfs found" >> /dev/kmsg - mode=8 + mode=1 } fi fi diff --git a/module/service.sh b/module/service.sh index 6af5b7e..54aecbe 100644 --- a/module/service.sh +++ b/module/service.sh @@ -29,8 +29,16 @@ normal_mount() { } ksu_susfs_bind() { - mount_bind - ${SUSFS_BIN} add_try_umount $target_hostsfile 1 + if [ "$( ${SUSFS_BIN} show version | head -n1 | sed 's/v//; s/\.//g' )" -ge 153 ]; then + mount_bind + ${SUSFS_BIN} add_try_umount $target_hostsfile 1 + else + ${SUSFS_BIN} add_sus_kstat '/system/etc/hosts' + mount_bind + ${SUSFS_BIN} update_sus_kstat '/system/etc/hosts' + ${SUSFS_BIN} add_try_umount $target_hostsfile 1 + ${SUSFS_BIN} add_try_umount $target_hostsfile > /dev/null 2>&1 #legacy susfs + fi echo "bindhosts: service.sh - mode ksu_susfs_bind" >> /dev/kmsg }