fix: isolate Gitea installer from GitHub
This commit is contained in:
+7
-7
@@ -2,13 +2,13 @@
|
||||
set -e
|
||||
|
||||
# VPS-Commander 一键安装与配置脚本 (Hub / Agent)
|
||||
# Repo: https://github.com/kyaring/vps-commander
|
||||
# Repo: https://gitea.king.nyc.mn/openclaw/vps-commander
|
||||
|
||||
REPO="kyaring/vps-commander"
|
||||
INSTALL_DIR="/opt/vps-commander"
|
||||
CONF_DIR="/etc/vps-commander"
|
||||
GITHUB_URL="https://github.com"
|
||||
API_URL="https://api.github.com"
|
||||
GITEA_URL="https://gitea.king.nyc.mn"
|
||||
API_URL="https://gitea.king.nyc.mn/api/v1"
|
||||
|
||||
# 颜色输出
|
||||
RED='\033[0;31m'
|
||||
@@ -40,7 +40,7 @@ command -v curl >/dev/null 2>&1 || (apt-get update && apt-get install -y curl ||
|
||||
info "正在获取 VPS-Commander 最新版本信息..."
|
||||
LATEST_TAG=$(curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 --connect-timeout 15 --max-time 30 "${API_URL}/repos/${REPO}/releases/latest" | sed -n 's/^[[:space:]]*"tag_name": "\([^"]*\)".*/\1/p' | head -n1)
|
||||
if [ -z "$LATEST_TAG" ]; then
|
||||
error "无法从 GitHub 获取最新正式 Release,已停止安装;不会回退到旧版本"
|
||||
error "无法从 Gitea 获取最新正式 Release,已停止安装;不会回退到旧版本"
|
||||
fi
|
||||
info "检测到最新版本: ${LATEST_TAG} (${TARGET_ARCH})"
|
||||
|
||||
@@ -60,7 +60,7 @@ download_verified() {
|
||||
error "下载结果为空: ${asset_name}"
|
||||
fi
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
checksum=$(curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 --connect-timeout 15 --max-time 60 "${GITHUB_URL}/${REPO}/releases/download/${LATEST_TAG}/checksums.txt") || error "无法获取 Release 校验文件"
|
||||
checksum=$(curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 --connect-timeout 15 --max-time 60 "${GITEA_URL}/${REPO}/releases/download/${LATEST_TAG}/checksums.txt") || error "无法获取 Release 校验文件"
|
||||
expected=$(printf '%s\n' "$checksum" | awk -v f="$asset_name" '$2 == f {print $1; exit}')
|
||||
[ -n "$expected" ] || error "Release 校验文件中缺少 ${asset_name}"
|
||||
actual=$(sha256sum "$tmp" | awk '{print $1}')
|
||||
@@ -100,7 +100,7 @@ select_mode() {
|
||||
install_agent() {
|
||||
info "开始安装 VPS-Commander Agent (${TARGET_ARCH})..."
|
||||
BIN_NAME="vps-commander-agent-linux-${TARGET_ARCH}"
|
||||
DOWNLOAD_URL="${GITHUB_URL}/${REPO}/releases/download/${LATEST_TAG}/${BIN_NAME}"
|
||||
DOWNLOAD_URL="${GITEA_URL}/${REPO}/releases/download/${LATEST_TAG}/${BIN_NAME}"
|
||||
|
||||
download_verified "${DOWNLOAD_URL}" "${INSTALL_DIR}/vps-commander-agent" "${BIN_NAME}"
|
||||
chmod +x "${INSTALL_DIR}/vps-commander-agent"
|
||||
@@ -164,7 +164,7 @@ SVC
|
||||
install_hub() {
|
||||
info "开始安装 VPS-Commander Hub (${TARGET_ARCH})..."
|
||||
BIN_NAME="vps-commander-hub-linux-${TARGET_ARCH}"
|
||||
DOWNLOAD_URL="${GITHUB_URL}/${REPO}/releases/download/${LATEST_TAG}/${BIN_NAME}"
|
||||
DOWNLOAD_URL="${GITEA_URL}/${REPO}/releases/download/${LATEST_TAG}/${BIN_NAME}"
|
||||
|
||||
download_verified "${DOWNLOAD_URL}" "${INSTALL_DIR}/vps-commander-hub" "${BIN_NAME}"
|
||||
chmod +x "${INSTALL_DIR}/vps-commander-hub"
|
||||
|
||||
Reference in New Issue
Block a user