Skip to content

Commit

Permalink
scripts: handle mode 1 restoration on legacy susfs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
backslashxx committed Jan 7, 2025
1 parent 9aceccf commit c5900e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions module/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions module/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c5900e2

Please sign in to comment.