Skip required-packages step on re-run

On second run, is_installed base (command -v ncdu) detects that base
packages are already present and jumps straight to the service menu,
skipping the required-setup banner, confirm prompt, and apt-get install.
The first-run path is unchanged; `sudo ./setup.sh base` forces reinstall.

https://claude.ai/code/session_01Y4dMKtkqkpvmgDKoRdzhTG
This commit is contained in:
Claude
2026-06-03 23:48:15 +00:00
parent 56d2f9e85b
commit 370c513606
+16 -3
View File
@@ -152,10 +152,23 @@ fi
# ── Guided interactive flow ──────────────────────────────────────────────────
require_root
# 1) Show the REQUIRED set and let the user cancel before anything happens.
_VER="$(cat "$HERE/VERSION" 2>/dev/null || echo '?')"
if is_installed base; then
# ── Re-run: base already present — skip required step ────────────────────
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ Ubuntu Post-Install · v$(cat "$HERE/VERSION" 2>/dev/null || echo '?')"
echo "║ Ubuntu Post-Install · v${_VER}"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
echo " Base packages already installed — skipping required setup."
echo " Use 'sudo ./setup.sh base' to force a reinstall."
echo ""
else
# ── First run: show required banner, confirm, install ────────────────────
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ Ubuntu Post-Install · v${_VER}"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
echo "REQUIRED (installed/verified first):"
@@ -172,12 +185,12 @@ if [ "$PROCEED" != "y" ] && [ "$PROCEED" != "Y" ]; then
exit 0
fi
# 2) Run required.
run_service base
if ! command -v docker >/dev/null 2>&1; then
log_warning "Docker is not installed. Containerized services need it."
echo " Install with: curl -fsSL https://get.docker.com | sh"
fi
fi
# 3) Offer site defaults wizard if .config has no SITE_TZ yet (first run).
if ! grep -q '^SITE_TZ=' "$DOCKER_DIR/.config" 2>/dev/null; then