refactor(core): 实施全局动态版本嗅探 (SSOT)。彻底移除引导外壳与内部安装链路中硬编码的静态版本号文本,提升 CI/CD 自动化持续集成效率

This commit is contained in:
hotyue
2026-06-04 06:51:12 +00:00
parent 49200f77cf
commit b120302afd
4 changed files with 24 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# ==========================================================
# 脚本名称: install_master.sh (v4.3.0 终极模块化引导入口)
# 核心功能: 极简引导入口。包含 Ctrl+C 优雅中断,采用物理文件执行规避管道污染
# 脚本名称: install_master.sh (动态模块化终极引导入口)
# 核心功能: 极简引导入口。包含 Ctrl+C 优雅中断,动态版本嗅探
# ==========================================================
cleanup_and_exit() {
@@ -22,9 +22,14 @@ fi
SECURE_TMP=$(mktemp -d /tmp/ips_master_install.XXXXXX)
REPO_RAW_URL="https://raw.githubusercontent.com/hotyue/IP-Sentinel/main"
echo -e "\n⏳ 正在拉取 IP-Sentinel Master v4.3.0 安装引擎..."
# ----------------------------------------------------------
# [核心架构升级] 动态嗅探云端真理之源 (SSOT)
# ----------------------------------------------------------
TARGET_VERSION=$( (curl -fsSL --connect-timeout 5 --retry 2 "${REPO_RAW_URL}/version.txt?t=$(date +%s)" || curl -4 -fsSL --connect-timeout 5 --retry 2 "${REPO_RAW_URL}/version.txt?t=$(date +%s)") 2>/dev/null | grep "^MASTER_VERSION=" | cut -d'=' -f2 | tr -d '[:space:]')
TARGET_VERSION=${TARGET_VERSION:-"4.3.1"}
echo -e "\n⏳ 正在拉取 IP-Sentinel Master v${TARGET_VERSION} 安装引擎..."
# 【核心防线】追加 ?t=$(date +%s) 强行击穿 GitHub CDN 缓存
curl -fsSL --connect-timeout 10 --retry 3 "${REPO_RAW_URL}/install/build_master.sh?t=$(date +%s)" -o "${SECURE_TMP}/build_master.sh"
if [ ! -s "${SECURE_TMP}/build_master.sh" ]; then
@@ -34,6 +39,7 @@ fi
export SECURE_TMP
export REPO_RAW_URL
export TARGET_VERSION
chmod +x "${SECURE_TMP}/build_master.sh"
bash "${SECURE_TMP}/build_master.sh"