From 2fb9a77b230701890642f681340f815ee764aa45 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:44:19 +0800 Subject: [PATCH 1/5] scripts/customize: create detach symlink in manager $PATH this is for APatch and KernelSU reference: https://github.com/backslashxx/bindhosts/commit/e1127a4d034bc3e2e1c1c1e02bf49cbdd2e35b75 --- magisk/customize.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/magisk/customize.sh b/magisk/customize.sh index ba0646c..1c4b6a3 100644 --- a/magisk/customize.sh +++ b/magisk/customize.sh @@ -7,6 +7,16 @@ fi mv -f "$MODPATH/system/bin/detach-${ARCH}" "$MODPATH/system/bin/detach" rm "$MODPATH"/system/bin/detach-* +# symlink detach to manager path +# for ez termux usage +manager_paths="/data/adb/ap/bin /data/adb/ksu/bin" +for i in $manager_paths; do + if [ -d $i ] && [ ! -f $i/detach ]; then + echo "[+] creating symlink in $i" + ln -sf /data/adb/modules/zygisk-detach/system/bin/detach $i/detach + fi +done + # preserve detach.bin if [ -f "$NVBASE/modules/zygisk-detach/detach.bin" ]; then ui_print "- Preserving existing detach.bin" From b51bd6f3054117315686d88f3b88faf28c37199e Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:49:37 +0800 Subject: [PATCH 2/5] scripts/service: create detach symlink for magisk at every boot --- magisk/service.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/magisk/service.sh b/magisk/service.sh index 9118f77..4b50d8c 100644 --- a/magisk/service.sh +++ b/magisk/service.sh @@ -1,3 +1,11 @@ #!/system/bin/sh MODDIR=${0%/*} [ -f "$MODDIR/detach.txt" ] && "$MODDIR"/system/bin/detach serialize "$MODDIR/detach.txt" "$MODDIR/detach.bin" + +# yes we just create the symlink at every boot these tmpfs dirs +# magisk will add /debug_ramdisk, /sbin on $PATH +[ -f /data/adb/magisk/magisk ] && { + [ -w /sbin ] && rwdir=/sbin + [ -w /debug_ramdisk ] && rwdir=/debug_ramdisk + ln -sf $MODDIR/system/bin/detach $rwdir/detach +} From 494226dec0e30c6aef7b9807745d597a557e9f90 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:50:35 +0800 Subject: [PATCH 3/5] module: leverage skip_mount --- magisk/skip_mount | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 magisk/skip_mount diff --git a/magisk/skip_mount b/magisk/skip_mount new file mode 100644 index 0000000..e69de29 From ad4ae1da00cb5028fb3737c3a1332a239d192edb Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:00:32 +0800 Subject: [PATCH 4/5] module/uninstall: clean symlinks at uninstall --- magisk/uninstall.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 magisk/uninstall.sh diff --git a/magisk/uninstall.sh b/magisk/uninstall.sh new file mode 100755 index 0000000..9343a5c --- /dev/null +++ b/magisk/uninstall.sh @@ -0,0 +1,2 @@ +rm /data/adb/ap/bin/detach +rm /data/adb/ksu/bin/detach From fd7dc7fbd715752c1293069626b7b069e8835c06 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Wed, 25 Dec 2024 13:28:53 +0800 Subject: [PATCH 5/5] webui: call /data/adb/modules/zygisk-detach/system/bin/detach instead of detach --- ksu-webui/src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ksu-webui/src/index.js b/ksu-webui/src/index.js index 600902d..db07a30 100644 --- a/ksu-webui/src/index.js +++ b/ksu-webui/src/index.js @@ -42,7 +42,7 @@ async function main() { const pkgs = await run("pm list packages"); if (pkgs === undefined) return; - const detached_list_out = await run("detach list"); + const detached_list_out = await run("/data/adb/modules/zygisk-detach/system/bin/detach list"); if (detached_list_out === undefined) return; const detached = detached_list_out.split('\n'); @@ -64,7 +64,7 @@ async function main() { document.getElementById("detach").addEventListener('click', (e) => { const detach_arg = detach_list.join(' '); - run(`detach detachall "${detach_arg}"`).then((out) => toast(out)); + run(`/data/adb/modules/zygisk-detach/system/bin/detach detachall "${detach_arg}"`).then((out) => toast(out)); }); }