安装脚本支持 arm64 + Alpine(架构自动检测)
This commit is contained in:
+14
-6
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# 3x-ui-agent 节点一键安装脚本
|
||||
# 用法: bash install-agent.sh --master http://MASTER_IP:2053 --token YOUR_AGENT_TOKEN [--name my-node]
|
||||
# 要求: Debian/Ubuntu/CentOS amd64, root 运行
|
||||
# 要求: Debian/Ubuntu/Alpine/CentOS (amd64/arm64), root 运行
|
||||
|
||||
set -e
|
||||
|
||||
@@ -25,10 +25,14 @@ done
|
||||
[[ -z "$TOKEN" ]] && error "缺少 --token 参数 (从主控面板 API 获取)"
|
||||
|
||||
ARCH=$(uname -m)
|
||||
[[ "$ARCH" != "x86_64" && "$ARCH" != "amd64" ]] && error "只支持 amd64, 当前: $ARCH"
|
||||
case "$ARCH" in
|
||||
x86_64|amd64) BIN_ARCH="amd64";;
|
||||
aarch64|arm64) BIN_ARCH="arm64";;
|
||||
*) error "不支持的架构: $ARCH (仅支持 amd64/arm64)";;
|
||||
esac
|
||||
|
||||
# 二进制下载地址(GitHub release,替换为实际地址)
|
||||
XUI_URL="${XUI_URL:-https://github.com/imamoxilin/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-amd64}"
|
||||
XUI_URL="${XUI_URL:-https://github.com/imamoxilin/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
|
||||
XRAY_VER="26.6.27"
|
||||
|
||||
info "创建目录..."
|
||||
@@ -40,9 +44,13 @@ chmod +x /usr/local/x-ui/x-ui
|
||||
|
||||
info "下载 xray v${XRAY_VER}..."
|
||||
cd /usr/local/x-ui/bin
|
||||
curl -fL -o Xray-linux-64.zip "https://github.com/XTLS/Xray-core/releases/download/v${XRAY_VER}/Xray-linux-64.zip" || error "xray 下载失败"
|
||||
unzip -o -q Xray-linux-64.zip xray && mv xray xray-linux-amd64 && chmod +x xray-linux-amd64
|
||||
rm -f Xray-linux-64.zip
|
||||
case "$BIN_ARCH" in
|
||||
amd64) XRAY_ZIP="Xray-linux-64.zip";;
|
||||
arm64) XRAY_ZIP="Xray-linux-arm64-v8a.zip";;
|
||||
esac
|
||||
curl -fL -o "$XRAY_ZIP" "https://github.com/XTLS/Xray-core/releases/download/v${XRAY_VER}/${XRAY_ZIP}" || error "xray 下载失败"
|
||||
unzip -o -q "$XRAY_ZIP" xray && mv xray "xray-linux-${BIN_ARCH}" && chmod +x "xray-linux-${BIN_ARCH}"
|
||||
rm -f "$XRAY_ZIP"
|
||||
|
||||
info "下载 geo 文件..."
|
||||
curl -fL -o geoip.dat "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" || error "geoip 下载失败"
|
||||
|
||||
Reference in New Issue
Block a user