fix(agent): 探测阶段自愈 nginx 版本目录并发布 v1.4.5
CI / verify (push) Canceled after 0s

This commit is contained in:
2026-09-28 14:43:59 +08:00
parent c92d06642f
commit 87c072f5d4
14 changed files with 104 additions and 20 deletions
+9
View File
@@ -14,6 +14,15 @@ UNIT=/etc/systemd/system/fonu-agent.service
mkdir -p "$CONF_DIR" /var/lib/fonu-agent/certs
systemctl stop fonu-agent 2>/dev/null || true
TMP_PREFIX="${PREFIX}.new"
# 迁移旧版 Agent 留在 nginx include 范围内的 <配置>.versions 目录(保留历史版本内容)
for NGINX_DIR in /etc/nginx/sites-enabled /etc/nginx/conf.d; do
[ -d "$NGINX_DIR" ] || continue
for LEGACY in "$NGINX_DIR"/*.versions; do
[ -d "$LEGACY" ] || continue
TARGET="$NGINX_DIR/.$(basename "$LEGACY")"
[ -e "$TARGET" ] || mv "$LEGACY" "$TARGET" || true
done
done
install -m 0755 "$AGENT_BINARY" "$TMP_PREFIX"
if [ ! -x "$TMP_PREFIX" ]; then
echo "agent 二进制安装失败:$TMP_PREFIX 不存在或不可执行" >&2