feat: add desktop app hot update channel
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# 下载全局代理功能所需的 sing-box 引擎二进制(macOS arm64/x64 + Windows x64)。
|
||||
# 这些二进制不进 git(太大),打包前跑一次即可。用法: bash scripts/fetch-singbox.sh
|
||||
set -euo pipefail
|
||||
VER="${SINGBOX_VERSION:-1.13.14}"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DEST="$ROOT/resources/singbox"
|
||||
mkdir -p "$DEST"
|
||||
cd "$DEST"
|
||||
|
||||
fetch() { # $1=平台目录 $2=资源名(不含扩展) $3=压缩类型 $4=包内二进制名
|
||||
local dir="$1" asset="$2" kind="$3" bin="$4"
|
||||
echo "▶ $dir …"
|
||||
if [ -f "$dir/$bin" ]; then echo " 已存在,跳过"; return; fi
|
||||
mkdir -p "$dir"
|
||||
local url="https://github.com/SagerNet/sing-box/releases/download/v${VER}/${asset}.${kind}"
|
||||
if [ "$kind" = "tar.gz" ]; then
|
||||
curl -fsSL "$url" -o t.tgz && tar xzf t.tgz && mv "${asset}/${bin}" "$dir/" && rm -rf t.tgz "$asset"
|
||||
else
|
||||
curl -fsSL "$url" -o t.zip && unzip -qo t.zip && mv "${asset}/${bin}" "$dir/" && rm -rf t.zip "$asset"
|
||||
fi
|
||||
chmod +x "$dir/$bin" 2>/dev/null || true
|
||||
echo " ✓ $dir/$bin"
|
||||
}
|
||||
|
||||
fetch "darwin-arm64" "sing-box-${VER}-darwin-arm64" "tar.gz" "sing-box"
|
||||
fetch "darwin-x64" "sing-box-${VER}-darwin-amd64" "tar.gz" "sing-box"
|
||||
fetch "windows-x64" "sing-box-${VER}-windows-amd64" "zip" "sing-box.exe"
|
||||
echo "全部就位 ✅ (sing-box v${VER})"
|
||||
Reference in New Issue
Block a user