Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复一些bug #6

Merged
merged 18 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt install -y xz-utils make git wget zip
sudo apt install -y xz-utils make git wget zip bash
echo "${{ github.action_path }}"
latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/stunnel/static-curl/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)
module_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/powerAn2020/ZeroTierOneForKSU/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)
if [ "$latest_version" = "$module_latest_version" ]; then
exit 0
fi
zerotier_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/zerotier/ZeroTierOne/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)

echo "VERSION=$zerotier_latest_version" >> $GITHUB_ENV

download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-${latest_version}.tar.xz"
echo ${download_link}
wget -O curl.tar.xz ${download_link}
Expand Down Expand Up @@ -62,20 +56,19 @@ jobs:
echo "version=${{ env.VERSION }}" >>module.prop
echo "versionCode=${versionCode}" >>module.prop
echo 'author=powerAn' >>module.prop
echo 'description=ZeroTier(${{ env.VERSION }}) with UI interface' >>module.prop
echo 'description=ZeroTier(${{ env.VERSION }}) with UI interface (DEV)' >>module.prop
git config --global user.email "action@example.com"
MESSAGE=$(git log -1 --pretty=%B)
echo "commit MESSAGE: $MESSAGE"
echo $MESSAGE > changelog.md
echo $MESSAGE > changelog_dev.md
git config --global user.name "github action"
git add module.prop update_arm64.json update_arm.json changelog.md
git commit -m "update Zerotier version:${{env.VERSION}}"
git add changelog_dev.md
echo "COMMIT=1" >> $GITHUB_ENV

- name: Build Zerotier for arm64
run: |
export PATH="$PWD/toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin/:${PATH}"
git clone https:///github.com/zerotier/ZeroTierOne.git --depth=1 -b ${{ env.VERSION }}
git clone https://github.com/zerotier/ZeroTierOne.git --depth=1 -b ${{ env.VERSION }}
cp -rf ZeroTierOne ZeroTierOne_ARM
cd ZeroTierOne
make -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ LDFLAGS="-s"
Expand All @@ -98,41 +91,46 @@ jobs:

- name: Generate module for arm64/arm
run: |
rm -rf ZeroTierOne ZeroTierOne_ARM toolchain ui-src update_arm64.json update_arm.json build.sh
# rm -rf ZeroTierOne ZeroTierOne_ARM toolchain ui-src update_arm64.json update_arm.json update_arm64_dev.json update_arm_dev.json build.sh changelog_dev.md
mv zerotier-one-arm64 zerotier-one
echo 'updateJson=https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/update_arm64.json' >>module.prop
ls -la
zip -r -o -X -ll ZeroTierForKSU-arm64-${{ env.VERSION }}.zip ./ -x '.git/*' -x '.gitignore' -x '.github/*' -x 'zerotier-one-arm' -x 'curl'
echo 'updateJson=https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/update_arm64_dev.json' >>module.prop
bash build.sh ZeroTierForKSU-arm64-${{ env.VERSION }}.zip
unzip -d ZeroTierForKSU-arm64-${{ env.VERSION }} ZeroTierForKSU-arm64-${{ env.VERSION }}.zip
mv -f zerotier-one-arm zerotier-one
mv -f curl bin/curl
sed -i "s/update_arm64/update_arm/g" module.prop
zip -r -o -X -ll ZeroTierForKSU-arm-${{ env.VERSION }}.zip ./ -x '.git/*' -x '.gitignore' -x '.github/*' -x 'ZeroTierForKSU-arm64-${{ env.VERSION }}.zip'
bash build.sh ZeroTierForKSU-arm-${{ env.VERSION }}.zip
unzip -d ZeroTierForKSU-arm-${{ env.VERSION }} ZeroTierForKSU-arm-${{ env.VERSION }}.zip


- name: Upload artifact
uses: actions/upload-artifact@v3
id: arm64-zip
uses: actions/upload-artifact@v4
with:
name: ZeroTierForKSU-arm64-${{ env.VERSION }}
path: ZeroTierForKSU-arm64-${{ env.VERSION }}.zip

- name: 输出 Artifact 下载地址
run: |
echo "Artifact2 下载地址: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo '{"version":"${{ env.VERSION }}","versionCode":'${{env.new_module_version}}',"zipUrl":"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog.md"}' >update_arm64.json
path: ./ZeroTierForKSU-arm64-${{ env.VERSION }}/*
retention-days: 7

- name: Upload artifact
uses: actions/upload-artifact@v3
id: arm-zip
# v2版本好像不会压缩包套压缩包,还没试
uses: actions/upload-artifact@v4
with:
name: ZeroTierForKSU-arm-${{ env.VERSION }}
path: ZeroTierForKSU-arm-${{ env.VERSION }}.zip
path: ./ZeroTierForKSU-arm-${{ env.VERSION }}/*
retention-days: 7

- name: 输出 Artifact 下载地址
run: |
echo "Artifact2 下载地址: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo '{"version":"${{ env.VERSION }}","versionCode":'${{env.new_module_version}}',"zipUrl":"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog.md"}' >update_arm.json
echo "Artifact1 下载地址: ${{ steps.arm-zip.outputs.artifact-url }}"
echo "Artifact2 下载地址: ${{ steps.arm64-zip.outputs.artifact-url }}"
echo '{"version":"${{ env.VERSION }}","versionCode":'${{env.new_module_version}}',"zipUrl":"${{ steps.arm64-zip.outputs.artifact-url }}","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog_dev.md"}' >update_arm64_dev.json
echo '{"version":"${{ env.VERSION }}","versionCode":'${{env.new_module_version}}',"zipUrl":"${{ steps.arm-zip.outputs.artifact-url }}","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog_dev.md"}' >update_arm_dev.json

- name: update json
run: |
git add update_arm64.json update_arm.json
git add update_arm64_dev.json update_arm_dev.json changelog_dev.md module.prop
git commit -m "update Zerotier version:${{env.VERSION}}"
echo "COMMIT=1" >> $GITHUB_ENV

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ jobs:
echo "${{ github.action_path }}"
latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/stunnel/static-curl/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)
module_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/powerAn2020/ZeroTierOneForKSU/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)
if [ "$latest_version" = "$module_latest_version" ]; then
zerotier_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/zerotier/ZeroTierOne/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)
if [ "$zerotier_latest_version" = "$module_latest_version" -a "${{github.event_name }}" = "schedule"]; then
exit 0
fi
zerotier_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/zerotier/ZeroTierOne/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1)

echo "VERSION=$zerotier_latest_version" >> $GITHUB_ENV

download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-${latest_version}.tar.xz"
echo ${download_link}
wget -O curl.tar.xz ${download_link}
Expand Down
51 changes: 41 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
#!/bin/bash
SH_DIR=$(cd "$(dirname "$0")";pwd)
baseDIR=$(cd "$(dirname "$0")" || exit; pwd)

if [ -f ${SH_DIR}/ZeroTierForKSU.zip ];then
rm ${SH_DIR}/ZeroTierForKSU.zip
if [ -f "${baseDIR}/$1" ]; then
rm "${baseDIR}/$1"
fi
cd ${SH_DIR}/ui-src
npm i
npm audit fix
npm run build
mv -f build ${SH_DIR}/webroot
cd ${SH_DIR}
zip -r -o -X -ll ZeroTierForKSU.zip ./ -x '.git/*' -x '.gitignore' -x '.github/*' -x '.vscode/*' -x 'ui-src' -x 'build.sh' -x 'update.json'

moduleFile="${baseDIR}/module_file"

cd ${baseDIR}
# 构建zip命令
zipCmd="zip -r -o -X $1 ./ "

# 遍历目录下的文件,如果不在排除列表中则添加到zip命令中
for file in $(ls -a "$baseDIR"); do
# echo "---${file##*/}---"
# filename=$(basename "$file")
# echo "===$filename==="
if [[ "${file}" == ".." || "${file}" == "." ]]; then
continue;
fi
add="A"
while read white;do
if [[ "${white}" == "${file}" ]]; then
# echo "===$white *=* $file======";
add="N";
break;
fi
done < $moduleFile

if [[ "$add" == "A" ]]; then
if [ -d $file ];then
zipCmd="${zipCmd} -x '${file}/*'"
else
zipCmd="${zipCmd} -x '$file'"
fi
fi
done

# 打印最终的zip命令
echo "$zipCmd"

# 执行zip命令
eval "$zipCmd"
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Merge pull request #5 from powerAn2020/dev 开机自启修复
修复bug
1 change: 1 addition & 0 deletions changelog_dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
清理代码,增加dev标识,设置页面增加代码仓库
3 changes: 2 additions & 1 deletion module.prop
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name=ZeroTier For KernelSU
version=1.12.2
versionCode=10331
author=powerAn
description=ZeroTier(1.12.2) with UI interface
description=ZeroTier(1.12.2) with UI interface (DEV)
updateJson=https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/update_arm_dev.json
16 changes: 16 additions & 0 deletions module_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
META-INF
webroot
api.sh
customize.sh
module.prop
README.md
service.sh
uninstall.sh
zerotier.inotify
zerotier.sh
zerotier-cli
zerotier-idtool
zerotier-one
LICENSE
changelog.md
3 changes: 2 additions & 1 deletion ui-src/src/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<van-switch v-model="uninstallKeep" @update:model-value="uninstallKeepSwitch" :loading="uninstallKeepLoading" />
</template>
</van-cell>
<van-cell title="查看源码" is-link url="https://github.com/powerAn2020/ZeroTierOneForKSU" />
</div>

</template>
Expand Down Expand Up @@ -59,7 +60,7 @@ const onSelect = (action) => {
defaultRoterMode.value = action.text;
showToast(action.text)
console.info(action)
if (action.text === '1') {
if (action.text == '1') {
console.info('main表优先模式')
execCmd('rm /data/adb/zerotier/ROUTER_RULE_NEW').then(v => {
console.info(v)
Expand Down
2 changes: 1 addition & 1 deletion update_arm.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.12.2","versionCode":10331,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/1.12.2/ZeroTierForKSU-arm-1.12.2.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}
{"version":"1.12.2","versionCode":10331,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/1.12.2/ZeroTierForKSU-arm-1.12.2.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}
2 changes: 1 addition & 1 deletion update_arm64.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.12.2","versionCode":10331,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/1.12.2/ZeroTierForKSU-arm64-1.12.2.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}
{"version":"1.12.2","versionCode":10331,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/1.12.2/ZeroTierForKSU-arm64-1.12.2.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}
1 change: 1 addition & 0 deletions update_arm64_dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.12.2","versionCode":10345,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/actions/runs/8741063431/artifacts/1426553784","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog_dev.md"}
1 change: 1 addition & 0 deletions update_arm_dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"1.12.2","versionCode":10345,"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/actions/runs/8741063431/artifacts/1426553917","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/dev/changelog_dev.md"}
Loading