fix(install): 安装锁定后将 install.html 归档为 .bak
防止已安装环境继续提供安装向导静态页;entrypoint 与升级脚本避免容器重建后恢复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+34
-4
@@ -333,6 +333,7 @@ set_install_complete() {
|
||||
[[ -n "$cname" ]] || return 0
|
||||
restore_install_lock_in_container "$cname"
|
||||
if nexus_container_has_install_lock "$cname"; then
|
||||
archive_install_wizard_in_container "$cname"
|
||||
upsert_env_var "$env_file" "NEXUS_INSTALL_WIZARD_PENDING" "0"
|
||||
info "安装已完成:NEXUS_INSTALL_WIZARD_PENDING=0"
|
||||
fi
|
||||
@@ -897,10 +898,33 @@ compose_up() {
|
||||
verify_nexus_1panel_network "$root" || return 1
|
||||
}
|
||||
|
||||
archive_install_wizard_in_container() {
|
||||
local cname="$1"
|
||||
[[ -n "$cname" ]] || return 0
|
||||
docker exec "$cname" sh -c '
|
||||
if [ -f /app/web/app/install.html.bak ]; then
|
||||
rm -f /app/web/app/install.html
|
||||
elif [ -f /app/web/app/install.html ]; then
|
||||
mv /app/web/app/install.html /app/web/app/install.html.bak
|
||||
fi
|
||||
' 2>/dev/null || true
|
||||
}
|
||||
|
||||
verify_install_wizard() {
|
||||
local root="$1"
|
||||
local port="${2:-$(nexus_publish_port "$root")}"
|
||||
local code
|
||||
local code cname
|
||||
cname="$(nexus_container_name)"
|
||||
if [[ -n "$cname" ]] && nexus_container_has_install_lock "$cname"; then
|
||||
archive_install_wizard_in_container "$cname"
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/app/install.html" 2>/dev/null || echo "000")
|
||||
if [[ "$code" == "404" ]]; then
|
||||
info " /app/install.html 已归档 → HTTP 404"
|
||||
return 0
|
||||
fi
|
||||
warn " 已锁定但 /app/install.html → HTTP $code"
|
||||
return 1
|
||||
fi
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/app/install.html" 2>/dev/null || echo "000")
|
||||
if [[ "$code" == "200" ]]; then
|
||||
info " /app/install.html → HTTP 200"
|
||||
@@ -1167,9 +1191,15 @@ cmd_upgrade() {
|
||||
[[ "$health" == "ok" ]] && break
|
||||
sleep 2
|
||||
done
|
||||
wiz_code="$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/app/install.html" 2>/dev/null || echo "000")"
|
||||
if [[ "$wiz_code" != "200" && -x "$NEXUS_ROOT/deploy/sync-install-wizard-to-container.sh" ]]; then
|
||||
NEXUS_PUBLISH_PORT="$port" NEXUS_ROOT="$NEXUS_ROOT" bash "$NEXUS_ROOT/deploy/sync-install-wizard-to-container.sh"
|
||||
cname="$(nexus_container_name)"
|
||||
if [[ -n "$cname" ]] && nexus_container_has_install_lock "$cname"; then
|
||||
archive_install_wizard_in_container "$cname"
|
||||
info "安装已锁定,跳过 install.html 热同步"
|
||||
else
|
||||
wiz_code="$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/app/install.html" 2>/dev/null || echo "000")"
|
||||
if [[ "$wiz_code" != "200" && -x "$NEXUS_ROOT/deploy/sync-install-wizard-to-container.sh" ]]; then
|
||||
NEXUS_PUBLISH_PORT="$port" NEXUS_ROOT="$NEXUS_ROOT" bash "$NEXUS_ROOT/deploy/sync-install-wizard-to-container.sh"
|
||||
fi
|
||||
fi
|
||||
set_install_complete "$NEXUS_ROOT"
|
||||
if [[ "$PRUNE_IMAGES" == true ]]; then
|
||||
|
||||
Reference in New Issue
Block a user