update zerotier module to support rootless app

This commit is contained in:
eventlOwOp
2024-07-02 12:25:20 +08:00
parent 7394eee0f0
commit fa2d60e1b8
11 changed files with 271 additions and 104 deletions
+8 -10
View File
@@ -1,26 +1,24 @@
#!/system/bin/sh
pipe=/data/adb/zerotier/run/pipe
cli_output=/data/adb/zerotier/run/cli.out
cli_pid=/data/adb/zerotier/run/cli.pid
ZTROOT=/data/adb/zerotier
PIPE=$ZTROOT/run/pipe
help_text="Usage: zerotier.sh {start|stop|restart|status}"
HELP="Usage: zerotier.sh {start|stop|restart|status}"
if [[ ! -p $pipe ]]; then
if [[ ! -f $PIPE ]]; then
echo "daemon not running"
exit 1
fi
rm -f $cli_output
echo $$ > $cli_pid
echo $$ > $ZTROOT/run/cli.pid
on_receive() {
kill -9 %%
cat $cli_output
cat $ZTROOT/run/cli.out
exit 0
}
run() {
echo $cmd > $pipe
echo $cmd > $PIPE
}
trap 'on_receive' SIGUSR1
@@ -35,7 +33,7 @@ if [[ $# -eq 1 ]]; then
*) echo "unknown command $cmd";;
esac
else
echo $help_text
echo $HELP
exit 1
fi