update daemon
This commit is contained in:
@@ -1,28 +1,12 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: build with GCC toolchains
|
name: build with GCC toolchains
|
||||||
|
|
||||||
# Controls when the workflow will run
|
|
||||||
on:
|
on:
|
||||||
# Triggers the workflow on push or pull request events but only for the "master" branch
|
|
||||||
# push:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "build"
|
|
||||||
build:
|
build:
|
||||||
# The type of runner that the job will run on
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- name: Checkout zerotier-magisk
|
- name: Checkout zerotier-magisk
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -32,7 +16,6 @@ jobs:
|
|||||||
repository: zerotier/ZeroTierOne
|
repository: zerotier/ZeroTierOne
|
||||||
path: ZeroTierOne
|
path: ZeroTierOne
|
||||||
|
|
||||||
# Runs a single command using the runners shell
|
|
||||||
- name: Prepare GCC Toolchain
|
- name: Prepare GCC Toolchain
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -qqy gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf g++-aarch64-linux-gnu g++-arm-linux-gnueabihf
|
sudo apt-get install -qqy gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf g++-aarch64-linux-gnu g++-arm-linux-gnueabihf
|
||||||
|
|||||||
@@ -1,32 +1,16 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: build with NDK toolchains
|
name: build with NDK toolchains
|
||||||
|
|
||||||
# Controls when the workflow will run
|
|
||||||
on:
|
on:
|
||||||
# Triggers the workflow on push or pull request events but only for the "master" branch
|
|
||||||
# push:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
api_version: 28 # min. 21
|
api_version: 28 # min. 21
|
||||||
ndk: r26d # android-ndk-$ndk-linux.zip
|
ndk: r26d # android-ndk-$ndk-linux.zip
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "build"
|
|
||||||
build:
|
build:
|
||||||
# The type of runner that the job will run on
|
runs-on: ubuntu-22.04
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
||||||
- name: Checkout zerotier-magisk
|
- name: Checkout zerotier-magisk
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -42,7 +26,6 @@ jobs:
|
|||||||
repository: miniupnp/libnatpmp
|
repository: miniupnp/libnatpmp
|
||||||
path: libnatpmp
|
path: libnatpmp
|
||||||
|
|
||||||
# Runs a single command using the runners shell
|
|
||||||
- name: Prepare NDK Toolchain
|
- name: Prepare NDK Toolchain
|
||||||
run: |
|
run: |
|
||||||
wget -qO ndk.zip https://dl.google.com/android/repository/android-ndk-$ndk-linux.zip
|
wget -qO ndk.zip https://dl.google.com/android/repository/android-ndk-$ndk-linux.zip
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
zerotier-magisk.zip
|
|
||||||
+16
-28
@@ -3,43 +3,31 @@
|
|||||||
SKIPUNZIP=1
|
SKIPUNZIP=1
|
||||||
ASH_STANDALONE=0
|
ASH_STANDALONE=0
|
||||||
|
|
||||||
ZT_PATH=/data/adb/zerotier
|
ZTPATH=/data/adb/zerotier
|
||||||
CONF_PATH=/sdcard/Android/zerotier
|
SYSBIN=/system/bin
|
||||||
CONF_NAME=network_id.txt
|
|
||||||
|
|
||||||
ui_print "- unzip"
|
ui_print "- unzip"
|
||||||
unzip -o "${ZIPFILE}" -x 'META-INF/*' -d "${MODPATH}" >&2
|
unzip -o $ZIPFILE -x 'META-INF/*' -d $MODPATH >&2
|
||||||
|
|
||||||
ui_print "- set file permission"
|
|
||||||
set_perm_recursive ${MODPATH}/zerotier 0 0 0755 0755
|
|
||||||
|
|
||||||
ui_print "- create work dir"
|
ui_print "- create work dir"
|
||||||
mkdir -p ${ZT_PATH}
|
mkdir -p $ZTPATH/run $ZTPATH/home
|
||||||
mkdir ${ZT_PATH}/run ${ZT_PATH}/home
|
mv $MODPATH/zerotier/* $ZTPATH
|
||||||
mv ${MODPATH}/zerotier/* ${ZT_PATH}
|
ln -sf $ZTPATH/zerotier-one $ZTPATH/zerotier-cli
|
||||||
|
ln -sf $ZTPATH/zerotier-one $ZTPATH/zerotier-idtool
|
||||||
|
|
||||||
ln -s ${ZT_PATH}/zerotier-one ${ZT_PATH}/zerotier-cli
|
ui_print "- link to system"
|
||||||
ln -s ${ZT_PATH}/zerotier-one ${ZT_PATH}/zerotier-idtool
|
mkdir -p $MODPATH$SYSBIN
|
||||||
|
ln -sf $ZTPATH/zerotier.sh $MODPATH$SYSBIN/zerotier.sh
|
||||||
|
ln -sf $ZTPATH/zerotier-cli $MODPATH$SYSBIN/zerotier-cli
|
||||||
|
|
||||||
ui_print "- create config dir"
|
ui_print "- set file permission"
|
||||||
mkdir -p ${CONF_PATH}
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
||||||
if [[ ! -e ${CONF_PATH}/${CONF_NAME} ]]; then
|
set_perm_recursive $ZTPATH 0 0 0755 0644
|
||||||
touch ${CONF_PATH}/${CONF_NAME}
|
|
||||||
echo "0000000000000000" > ${CONF_PATH}/${CONF_NAME}
|
|
||||||
fi
|
|
||||||
|
|
||||||
ui_print "- clean up"
|
|
||||||
rm -rf ${MODPATH}/customize.sh 2>/dev/null
|
|
||||||
rm -rf ${MODPATH}/bin 2>/dev/null
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
ui_print "- installed"
|
ui_print "- installed"
|
||||||
|
|
||||||
set_perm_recursive ${MODPATH} 0 0 0755 0644
|
|
||||||
|
|
||||||
ui_print "---------- information -----------"
|
ui_print "---------- information -----------"
|
||||||
ui_print "- zerotier root: ${ZT_PATH}"
|
ui_print "- zerotier root: $ZTPATH"
|
||||||
ui_print "- zerotier version: $(grep_prop version ${TMPDIR}/module.prop)"
|
ui_print "- zerotier version: $(grep_prop version $TMPDIR/module.prop)"
|
||||||
ui_print "- config file path: ${CONF_PATH}/${CONF_NAME}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
id=zerotier
|
id=zerotier
|
||||||
name=Zerotier For Magisk
|
name=ZeroTier for Magisk
|
||||||
version=v1.14.0
|
version=v1.14.0
|
||||||
versionCode=100
|
versionCode=114
|
||||||
author=eventlOwOp
|
author=eventlOwOp
|
||||||
description=zerotier for magisk
|
description=zerotier for magisk
|
||||||
|
|||||||
+20
-65
@@ -2,16 +2,15 @@
|
|||||||
|
|
||||||
MODDIR=${0%/*}
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
zerotier_root=/data/adb/zerotier
|
ZTROOT=/data/adb/zerotier
|
||||||
|
ZTRUNTIME=$ZTROOT/run
|
||||||
|
|
||||||
pipe=/data/adb/zerotier/run/pipe
|
pipe=$ZTRUNTIME/pipe
|
||||||
zerotier_log=/data/adb/zerotier/run/zerotier.log
|
ZTLOG=$ZTRUNTIME/zerotier.log
|
||||||
daemon_log=/data/adb/zerotier/run/daemon.log
|
daemon_log=$ZTRUNTIME/daemon.log
|
||||||
network_id_path=/sdcard/Android/zerotier/network_id.txt
|
|
||||||
pid=-1
|
|
||||||
|
|
||||||
cli_output=/data/adb/zerotier/run/cli.out
|
cli_output=$ZTRUNTIME/cli.out
|
||||||
cli_pid=/data/adb/zerotier/run/cli.pid
|
cli_pid=$ZTRUNTIME/cli.pid
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
t=`date +"%m-%d %H:%M:%S.%3N"`
|
t=`date +"%m-%d %H:%M:%S.%3N"`
|
||||||
@@ -23,40 +22,31 @@ log_cli() {
|
|||||||
}
|
}
|
||||||
_stop() {
|
_stop() {
|
||||||
pid=`pidof zerotier-one`
|
pid=`pidof zerotier-one`
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
log "zerotier-one not running"
|
log "zerotier-one not running"
|
||||||
return 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill -9 $pid
|
kill -9 $pid
|
||||||
ret=$?
|
if [[ $? -ne 0 ]]; then
|
||||||
|
|
||||||
if [ $ret -eq 0 ]; then
|
|
||||||
log "stopped zerotier-one"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
log "kill zerotier-one failed"
|
log "kill zerotier-one failed"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
wait
|
||||||
|
log "stopped zerotier-one"
|
||||||
}
|
}
|
||||||
|
|
||||||
__start() {
|
__start() {
|
||||||
nohup ./zerotier-one -d >> $zerotier_log 2>&1 &
|
$ZTROOT/zerotier-one -d >> $ZTLOG 2>&1 &
|
||||||
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
pid=`pidof zerotier-one`
|
|
||||||
}
|
}
|
||||||
_start() {
|
_start() {
|
||||||
if pid=`pidof zerotier-one`; then
|
if pid=`pidof zerotier-one`; then
|
||||||
log "zerotier-one already running pid $pid"
|
log "zerotier-one already running pid $pid"
|
||||||
else
|
else
|
||||||
__start
|
__start
|
||||||
|
pid=`pidof zerotier-one`
|
||||||
log "started zerotier-one pid $pid"
|
log "started zerotier-one pid $pid"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
_status() {
|
_status() {
|
||||||
# fake systemd lol
|
# fake systemd lol
|
||||||
@@ -72,45 +62,14 @@ _status() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# _join() {
|
cd $ZTROOT
|
||||||
# nid=$(cat $network_id_path)
|
rm -f $ZTRUNTIME
|
||||||
|
|
||||||
# ./zerotier-cli join $nid >> $zerotier_log 2>&1
|
|
||||||
|
|
||||||
# if [ $? -ne 0 ]; then
|
|
||||||
# log "join network failed"
|
|
||||||
# return 1
|
|
||||||
# else
|
|
||||||
# log "joined $nid"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# return 0
|
|
||||||
# }
|
|
||||||
|
|
||||||
# _leave() {
|
|
||||||
# nid=$(cat $network_id_path)
|
|
||||||
|
|
||||||
# ./zerotier-cli leave $nid >> $zerotier_log 2>&1
|
|
||||||
|
|
||||||
# if [ $? -ne 0 ]; then
|
|
||||||
# log "leave network failed"
|
|
||||||
# return 1
|
|
||||||
# else
|
|
||||||
# log "left $nid"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# return 0
|
|
||||||
# }
|
|
||||||
|
|
||||||
cd /data/adb/zerotier
|
|
||||||
rm -f ./run/*
|
|
||||||
mkfifo $pipe
|
mkfifo $pipe
|
||||||
|
|
||||||
ip rule add from all lookup main pref 1
|
ip rule add from all lookup main pref 1
|
||||||
export LD_LIBRARY_PATH=/data/adb/zerotier/lib
|
export LD_LIBRARY_PATH=/data/adb/zerotier/lib
|
||||||
|
|
||||||
__start
|
__start
|
||||||
(sleep 20 && _join) &
|
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
@@ -118,13 +77,9 @@ do
|
|||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
"start") _start;;
|
"start") _start;;
|
||||||
"stop") _stop;;
|
"stop") _stop;;
|
||||||
"restart")
|
"restart") _stop; _start;;
|
||||||
_stop
|
|
||||||
sleep 1
|
|
||||||
_start;;
|
|
||||||
"status") _status;;
|
"status") _status;;
|
||||||
*)
|
*) log "unknown command $cmd";;
|
||||||
log "unknown command $cmd";;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cpid=`cat $cli_pid`
|
cpid=`cat $cli_pid`
|
||||||
|
|||||||
+1
-2
@@ -1,2 +1 @@
|
|||||||
rm -rf /data/adb/zerotier
|
rm -rf /data/adb/zerotier
|
||||||
rm -rf /sdcard/Android/zerotier
|
|
||||||
+13
-16
@@ -15,28 +15,24 @@ rm -f $cli_output
|
|||||||
echo $$ > $cli_pid
|
echo $$ > $cli_pid
|
||||||
|
|
||||||
on_receive() {
|
on_receive() {
|
||||||
|
kill -9 %%
|
||||||
cat $cli_output
|
cat $cli_output
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
run() {
|
run() {
|
||||||
echo $1 > $pipe
|
echo $cmd > $pipe
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'on_receive' SIGUSR1
|
trap 'on_receive' SIGUSR1
|
||||||
|
cmd=$1
|
||||||
|
|
||||||
if [[ "$1" ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
if [[ "$2" ]]; then
|
case "$cmd" in
|
||||||
echo $help_text
|
"start") run;;
|
||||||
exit 1
|
"stop") run;;
|
||||||
fi
|
"restart") run;;
|
||||||
|
"status") run;;
|
||||||
case "$1" in
|
*) echo "unknown command $cmd";;
|
||||||
"start") run $1;;
|
|
||||||
"stop") run $1;;
|
|
||||||
"restart") run $1;;
|
|
||||||
"status") run $1;;
|
|
||||||
*)
|
|
||||||
echo "unknown command $1";;
|
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo $help_text
|
echo $help_text
|
||||||
@@ -44,6 +40,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 20 &
|
sleep 20 &
|
||||||
wait $!
|
wait
|
||||||
echo "time out"
|
|
||||||
|
echo "20 seconds time out"
|
||||||
exit 1
|
exit 1
|
||||||
Reference in New Issue
Block a user