add SSO build support & armv7 ndk build support
This commit is contained in:
@@ -18,7 +18,7 @@ jobs:
|
|||||||
# This workflow contains a single job called "build"
|
# This workflow contains a single job called "build"
|
||||||
build:
|
build:
|
||||||
# The type of runner that the job will run on
|
# The type of runner that the job will run on
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
@@ -32,53 +32,61 @@ jobs:
|
|||||||
repository: zerotier/ZeroTierOne
|
repository: zerotier/ZeroTierOne
|
||||||
path: ZeroTierOne
|
path: ZeroTierOne
|
||||||
|
|
||||||
- name: Checkout libnatpmp
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: miniupnp/libnatpmp
|
|
||||||
path: libnatpmp
|
|
||||||
|
|
||||||
# Runs a single command using the runners shell
|
# 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
|
||||||
|
rustup target add aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: Build for aarch64
|
sudo dpkg --add-architecture arm64
|
||||||
|
sudo mv build/sources.list /etc/apt/sources.list
|
||||||
|
sudo apt-get update -qqy
|
||||||
|
sudo apt-get install -qqy libssl-dev:arm64
|
||||||
|
|
||||||
|
- name: Patch ZeroTier for Cross-Compile
|
||||||
|
run: |
|
||||||
|
pip3 install toml
|
||||||
|
python3 build/build_helper.py
|
||||||
|
|
||||||
|
- name: Build for Aarch64
|
||||||
run: |
|
run: |
|
||||||
CC=aarch64-linux-gnu-gcc
|
CC=aarch64-linux-gnu-gcc
|
||||||
CXX=aarch64-linux-gnu-g++
|
CXX=aarch64-linux-gnu-g++
|
||||||
|
|
||||||
cd libnatpmp
|
|
||||||
make --silent CC=$CC natpmpc-shared
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd ZeroTierOne
|
cd ZeroTierOne
|
||||||
make --silent -j $(nproc) ZT_SSO_SUPPORTED=0 ZT_STATIC=1 ZT_DEBUG=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp -s" DEFS="-I../libnatpmp"
|
mv make-linux.mk.aarch64 make-linux.mk
|
||||||
|
make clean
|
||||||
|
make --silent -j $(nproc) ZT_SSO_SUPPORTED=0 ZT_STATIC=1 ZT_DEBUG=0 CC="$CC -w" CXX="$CXX -w" LDFLAGS="-s"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
mkdir -p magisk/zerotier/lib
|
|
||||||
cp ZeroTierOne/zerotier-one magisk/zerotier
|
cp ZeroTierOne/zerotier-one magisk/zerotier
|
||||||
cd magisk
|
cd magisk
|
||||||
zip -q -r ../zerotier-magisk-aarch64-gcc.zip .
|
zip -q -r ../zerotier-magisk-aarch64-gcc.zip .
|
||||||
|
|
||||||
- name: Build for arm
|
- name: Build for Aarch64 with SSO
|
||||||
run: |
|
run: |
|
||||||
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
CC=aarch64-linux-gnu-gcc
|
||||||
PATH=`pwd`/libnatpmp:$PATH
|
CXX=aarch64-linux-gnu-g++
|
||||||
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
|
|
||||||
|
|
||||||
CC=arm-linux-gnueabihf-gcc
|
|
||||||
CXX=arm-linux-gnueabihf-g++
|
|
||||||
|
|
||||||
cd libnatpmp
|
|
||||||
make clean
|
|
||||||
make CC=$CC natpmpc-shared
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd ZeroTierOne
|
cd ZeroTierOne
|
||||||
make clean
|
make clean
|
||||||
# sed -i "s/armv7ve/armv7a/g" make-linux.mk
|
make --silent -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 CC="$CC -w" CXX="$CXX -w" LDFLAGS="-s"
|
||||||
make -j $(nproc) ZT_SSO_SUPPORTED=0 ZT_STATIC=1 ZT_DEBUG=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp -s" DEFS="-I../libnatpmp"
|
cd ..
|
||||||
|
|
||||||
|
cp ZeroTierOne/zerotier-one magisk/zerotier
|
||||||
|
cd magisk
|
||||||
|
zip -q -r ../zerotier-magisk-aarch64-gcc-SSO.zip .
|
||||||
|
|
||||||
|
- name: Build for Arm
|
||||||
|
run: |
|
||||||
|
CC=arm-linux-gnueabihf-gcc
|
||||||
|
CXX=arm-linux-gnueabihf-g++
|
||||||
|
FLAGS="-w -fcompare-debug-second"
|
||||||
|
|
||||||
|
cd ZeroTierOne
|
||||||
|
mv make-linux.mk.arm make-linux.mk
|
||||||
|
make clean
|
||||||
|
make --silent -j $(nproc) ZT_SSO_SUPPORTED=0 ZT_STATIC=1 ZT_DEBUG=0 CC="$CC $FLAGS" CXX="$CXX $FLAGS" LDFLAGS="-s"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cp ZeroTierOne/zerotier-one magisk/zerotier/
|
cp ZeroTierOne/zerotier-one magisk/zerotier/
|
||||||
@@ -87,7 +95,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get Date
|
- name: Get Date
|
||||||
id: date
|
id: date
|
||||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -95,6 +103,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
|
zerotier-magisk-aarch64-gcc-SSO.zip
|
||||||
zerotier-magisk-aarch64-gcc.zip
|
zerotier-magisk-aarch64-gcc.zip
|
||||||
zerotier-magisk-arm-gcc.zip
|
zerotier-magisk-arm-gcc.zip
|
||||||
tag_name: SNAPSHOT-GCC-${{ steps.date.outputs.date }}
|
tag_name: SNAPSHOT-GCC-${{ steps.date.outputs.date }}
|
||||||
@@ -102,5 +111,5 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
- name: Debugging with tmate
|
# - name: Debugging with tmate
|
||||||
uses: mxschmitt/action-tmate@v3.18
|
# uses: mxschmitt/action-tmate@v3.18
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ jobs:
|
|||||||
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
|
||||||
unzip -qq ndk.zip "android-ndk-$ndk/toolchains/*" && rm ndk.zip -f
|
unzip -qq ndk.zip "android-ndk-$ndk/toolchains/*" && rm ndk.zip -f
|
||||||
|
|
||||||
- name: Build for aarch64
|
- name: Patch ZeroTier for Cross-Compile
|
||||||
|
run: |
|
||||||
|
pip3 install toml
|
||||||
|
python3 build/build_helper.py
|
||||||
|
|
||||||
|
- name: Build for Aarch64
|
||||||
run: |
|
run: |
|
||||||
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
||||||
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
|
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
|
||||||
@@ -57,10 +62,12 @@ jobs:
|
|||||||
CXX=aarch64-linux-android$api_version-clang++
|
CXX=aarch64-linux-android$api_version-clang++
|
||||||
|
|
||||||
cd libnatpmp
|
cd libnatpmp
|
||||||
|
make clean
|
||||||
make --silent CC=$CC natpmpc-shared
|
make --silent CC=$CC natpmpc-shared
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd ZeroTierOne
|
cd ZeroTierOne
|
||||||
|
make clean
|
||||||
make --silent -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
|
make --silent -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
@@ -70,37 +77,33 @@ jobs:
|
|||||||
cd magisk
|
cd magisk
|
||||||
zip -q -r ../zerotier-magisk-aarch64-ndk.zip .
|
zip -q -r ../zerotier-magisk-aarch64-ndk.zip .
|
||||||
|
|
||||||
# - name: Build for arm
|
- name: Build for Arm
|
||||||
# run: |
|
run: |
|
||||||
# PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
PATH=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
||||||
# PATH=`pwd`/libnatpmp:$PATH
|
NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
|
||||||
# NDK_ROOT=`pwd`/android-ndk-$ndk/toolchains/llvm/prebuilt/linux-x86_64
|
|
||||||
|
|
||||||
# CC=armv7a-linux-androideabi$api_version-clang
|
CC=armv7a-linux-androideabi$api_version-clang
|
||||||
# CXX=armv7a-linux-androideabi$api_version-clang++
|
CXX=armv7a-linux-androideabi$api_version-clang++
|
||||||
|
|
||||||
# cd libnatpmp
|
cd libnatpmp
|
||||||
# make clean
|
make clean
|
||||||
# make CC=$CC natpmpc-shared
|
make CC=$CC natpmpc-shared
|
||||||
# cd ..
|
cd ..
|
||||||
|
|
||||||
# cd ZeroTierOne
|
cd ZeroTierOne
|
||||||
# make clean
|
mv make-linux.mk.arm.ndk make-linux.mk
|
||||||
# sed -i "s/armv7ve/armv7a/g" make-linux.mk
|
make clean
|
||||||
# make -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
|
make -j $(nproc) ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=$CC CXX=$CXX LDFLAGS="-L../libnatpmp" DEFS="-I../libnatpmp -D__GLIBC__=0"
|
||||||
# cd ..
|
cd ..
|
||||||
|
|
||||||
# cp ZeroTierOne/zerotier-one magisk/zerotier/
|
cp ZeroTierOne/zerotier-one magisk/zerotier/
|
||||||
# cp $NDK_ROOT/sysroot/usr/lib/arm-linux-android/libc++_shared.so magisk/zerotier/lib
|
cp $NDK_ROOT/sysroot/usr/lib/arm-linux-android/libc++_shared.so magisk/zerotier/lib
|
||||||
# cd magisk
|
cd magisk
|
||||||
# zip -q -r ../zerotier-magisk-arm-ndk.zip .
|
zip -q -r ../zerotier-magisk-arm-ndk.zip .
|
||||||
|
|
||||||
# - name: Debugging with tmate
|
|
||||||
# uses: mxschmitt/action-tmate@v3.18
|
|
||||||
|
|
||||||
- name: Get Date
|
- name: Get Date
|
||||||
id: date
|
id: date
|
||||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -109,7 +112,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
zerotier-magisk-aarch64-ndk.zip
|
zerotier-magisk-aarch64-ndk.zip
|
||||||
|
zerotier-magisk-arm-ndk.zip
|
||||||
tag_name: SNAPSHOT-NDK-${{ steps.date.outputs.date }}
|
tag_name: SNAPSHOT-NDK-${{ steps.date.outputs.date }}
|
||||||
name: SNAPSHOT-NDK-${{ steps.date.outputs.date }}
|
name: SNAPSHOT-NDK-${{ steps.date.outputs.date }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
|
# - name: Debugging with tmate
|
||||||
|
# uses: mxschmitt/action-tmate@v3.18
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ To restart, execute (in root) `sh /data/adb/zerotier/zerotier.sh restart`; An an
|
|||||||
```
|
```
|
||||||
/data/adb/zerotier/
|
/data/adb/zerotier/
|
||||||
| - run/
|
| - run/
|
||||||
| | - pid # zerotier-one pid
|
|
||||||
| | - pipe # pipe to service.sh
|
| | - pipe # pipe to service.sh
|
||||||
| | - daemon.log # service.sh log
|
| | - daemon.log # service.sh log
|
||||||
| ` - zerotier.log # zerotier-one log
|
| ` - zerotier.log # zerotier-one log
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
```
|
```
|
||||||
/data/adb/zerotier/
|
/data/adb/zerotier/
|
||||||
| - run/
|
| - run/
|
||||||
| | - pid # zerotier-one pid
|
|
||||||
| | - pipe # pipe to service.sh
|
| | - pipe # pipe to service.sh
|
||||||
| | - daemon.log # service.sh log
|
| | - daemon.log # service.sh log
|
||||||
| ` - zerotier.log # zerotier-one log
|
| ` - zerotier.log # zerotier-one log
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import toml
|
||||||
|
|
||||||
|
# Patch ZeroTierOne/rustybits/zeroidc/Cargo.toml
|
||||||
|
|
||||||
|
# > +ZeroTierOne/rustybits/zeroidc/Cargo.toml
|
||||||
|
# [dependencies]
|
||||||
|
# openssl-sys = {version = ">=0.9", features = ["vendored"]}
|
||||||
|
|
||||||
|
cargo_toml_path = "ZeroTierOne/rustybits/zeroidc/Cargo.toml"
|
||||||
|
cargo_toml = toml.load(cargo_toml_path)
|
||||||
|
cargo_toml['dependencies']['openssl-sys'] = { 'version': ">=0.9", 'features': ["vendored"] }
|
||||||
|
with open(cargo_toml_path, 'w') as f:
|
||||||
|
toml.dump(cargo_toml, f)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Patch ZeroTierOne/rustybits/zeroidc/.cargo/config.toml
|
||||||
|
|
||||||
|
# > +ZeroTierOne/rustybits/zeroidc/.cargo/config.toml
|
||||||
|
# [target.armv7-unknown-linux-gnueabihf]
|
||||||
|
# linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
# rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
# [target.aarch64-unknown-linux-gnu]
|
||||||
|
# linker = "aarch64-linux-gnu-gcc"
|
||||||
|
# rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
|
config_toml_path = "ZeroTierOne/rustybits/zeroidc/.cargo/config.toml"
|
||||||
|
config_toml = toml.load(config_toml_path)
|
||||||
|
config_toml['target']['armv7-unknown-linux-gnueabihf'] = { "linker": "arm-linux-gnueabihf-gcc" }
|
||||||
|
config_toml['target']['aarch64-unknown-linux-gnu'] = { "linker": "aarch64-linux-gnu-gcc" }
|
||||||
|
with open(config_toml_path, 'w') as f:
|
||||||
|
toml.dump(config_toml, f)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Patch make-linux.mk
|
||||||
|
|
||||||
|
make_linux_path = 'ZeroTierOne/make-linux.mk'
|
||||||
|
with open(make_linux_path, 'r') as file:
|
||||||
|
data = file.read()
|
||||||
|
patch_aarch64 = data.replace(
|
||||||
|
'$(ZT_CARGO_FLAGS)', '$(ZT_CARGO_FLAGS) --target aarch64-unknown-linux-gnu --quiet'
|
||||||
|
).replace(
|
||||||
|
'rustybits/target/release/libzeroidc.a', 'rustybits/target/aarch64-unknown-linux-gnu/release/libzeroidc.a'
|
||||||
|
)
|
||||||
|
patch_arm = data.replace(
|
||||||
|
"$(shell $(CC) -dumpmachine | cut -d '-' -f 1)", 'armhf'
|
||||||
|
).replace(
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv6zk -marm -mfpu=vfp -mno-unaligned-access -mtp=cp15 -mcpu=arm1176jzf-s',
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv7-a -marm -mfpu=vfp'
|
||||||
|
).replace(
|
||||||
|
'override CXXFLAGS+=-mfloat-abi=hard -march=armv6zk -marm -mfpu=vfp -fexceptions -mno-unaligned-access -mtp=cp15 -mcpu=arm1176jzf-s',
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv7-a -marm -mfpu=vfp -fexceptions'
|
||||||
|
)
|
||||||
|
patch_arm_ndk = data.replace(
|
||||||
|
"$(shell $(CC) -dumpmachine | cut -d '-' -f 1)", 'armhf'
|
||||||
|
).replace(
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv6zk -marm -mfpu=vfp -mno-unaligned-access -mtp=cp15 -mcpu=arm1176jzf-s',
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv7-a -marm -mfpu=vfp'
|
||||||
|
).replace(
|
||||||
|
'override CXXFLAGS+=-mfloat-abi=hard -march=armv6zk -marm -mfpu=vfp -fexceptions -mno-unaligned-access -mtp=cp15 -mcpu=arm1176jzf-s',
|
||||||
|
'override CFLAGS+=-mfloat-abi=hard -march=armv7-a -marm -mfpu=vfp -fexceptions'
|
||||||
|
)
|
||||||
|
|
||||||
|
with open(make_linux_path + '.aarch64', 'w') as file:
|
||||||
|
file.write(patch_aarch64)
|
||||||
|
with open(make_linux_path + '.arm', 'w') as file:
|
||||||
|
file.write(patch_arm)
|
||||||
|
with open(make_linux_path + '.arm.ndk', 'w') as file:
|
||||||
|
file.write(patch_arm_ndk)
|
||||||
|
|
||||||
|
# Patch ZeroTierOne/osdep/OSUtils.cpp
|
||||||
|
|
||||||
|
osutil_path = 'ZeroTierOne/osdep/OSUtils.cpp'
|
||||||
|
with open(osutil_path, 'r') as file:
|
||||||
|
data = file.read().replace(
|
||||||
|
'/var/lib/zerotier-one', '/data/adb/zerotier/home'
|
||||||
|
)
|
||||||
|
with open(osutil_path, 'w') as file:
|
||||||
|
file.write(data)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# refer to https://tauri.app/v1/guides/building/linux/#cross-compiling-tauri-applications-for-arm-based-devices
|
||||||
|
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy main restricted
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy universe
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates universe
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy multiverse
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
|
||||||
|
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
|
||||||
|
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security main restricted
|
||||||
|
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security universe
|
||||||
|
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security multiverse
|
||||||
|
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy universe
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates universe
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy multiverse
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security universe
|
||||||
|
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse
|
||||||
+6
-5
@@ -6,11 +6,13 @@ pipe=/data/adb/zerotier/run/pipe
|
|||||||
zerotier_log=/data/adb/zerotier/run/zerotier.log
|
zerotier_log=/data/adb/zerotier/run/zerotier.log
|
||||||
daemon_log=/data/adb/zerotier/run/daemon.log
|
daemon_log=/data/adb/zerotier/run/daemon.log
|
||||||
network_id_path=/sdcard/Android/zerotier/network_id.txt
|
network_id_path=/sdcard/Android/zerotier/network_id.txt
|
||||||
|
temp_output=/data/adb/zerotier/run/temp.out
|
||||||
pid=-1
|
pid=-1
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
t=`date +"%m-%d %H:%M:%S.%3N"`
|
t=`date +"%m-%d %H:%M:%S.%3N"`
|
||||||
echo "[$t][$$][L] $1" >> $daemon_log
|
echo "[$t][$$][L] $1" >> $daemon_log
|
||||||
|
echo $1 >> $temp_output
|
||||||
}
|
}
|
||||||
_stop() {
|
_stop() {
|
||||||
pid=$(pidof zerotier-one)
|
pid=$(pidof zerotier-one)
|
||||||
@@ -35,7 +37,7 @@ _stop() {
|
|||||||
_join() {
|
_join() {
|
||||||
nid=$(cat $network_id_path)
|
nid=$(cat $network_id_path)
|
||||||
|
|
||||||
./zerotier-cli -D./home join $nid >> $zerotier_log 2>&1
|
./zerotier-cli join $nid >> $zerotier_log 2>&1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log "join network failed"
|
log "join network failed"
|
||||||
@@ -50,7 +52,7 @@ _join() {
|
|||||||
_leave() {
|
_leave() {
|
||||||
nid=$(cat $network_id_path)
|
nid=$(cat $network_id_path)
|
||||||
|
|
||||||
./zerotier-cli -D./home leave $nid >> $zerotier_log 2>&1
|
./zerotier-cli leave $nid >> $zerotier_log 2>&1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log "leave network failed"
|
log "leave network failed"
|
||||||
@@ -62,7 +64,7 @@ _leave() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
__start() {
|
__start() {
|
||||||
nohup ./zerotier-one -d home >> $zerotier_log 2>&1 &
|
nohup ./zerotier-one -d >> $zerotier_log 2>&1 &
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
@@ -87,8 +89,7 @@ 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 1
|
(sleep 20 && _join) &
|
||||||
_join
|
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
pipe=/data/adb/zerotier/run/pipe
|
pipe=/data/adb/zerotier/run/pipe
|
||||||
|
temp_output=/data/adb/zerotier/run/temp.out
|
||||||
if [[ ! -p $pipe ]]; then
|
if [[ ! -p $pipe ]]; then
|
||||||
echo "daemon not running"
|
echo "daemon not running"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user