Fix template detection (stderr progress, resolve live filename); banner

This commit is contained in:
jtricerolph 2026-07-01 12:46:30 +00:00
parent 4622cc3d45
commit e1ecfba8ac

View file

@ -27,7 +27,7 @@ header_info() {
printf "${BL}" printf "${BL}"
cat <<'BANNER' cat <<'BANNER'
╔══════════════════════════════════════════════════════════════╗ ╔══════════════════════════════════════════════════════════════╗
║ HNF MANAGE — PROXMOX STACK INSTALLER ║ HOTEL MANAGE — PROXMOX STACK INSTALLER ║
║ postgres · auth · portal · npm · mgmt · noticeboard ║ ║ postgres · auth · portal · npm · mgmt · noticeboard ║
╚══════════════════════════════════════════════════════════════╝ ╚══════════════════════════════════════════════════════════════╝
BANNER BANNER
@ -82,14 +82,20 @@ Then re-run this installer." 18 62
# ── Ensure Ubuntu 22.04 template ───────────────────────────────────────────── # ── Ensure Ubuntu 22.04 template ─────────────────────────────────────────────
ensure_template() { ensure_template() {
# NOTE: progress goes to stderr — stdout is captured as the template volid.
local tmpl local tmpl
tmpl=$(pveam list local 2>/dev/null | awk '/ubuntu-22\.04/{print $1; exit}') tmpl=$(pveam list local 2>/dev/null | awk '/ubuntu-22\.04-standard/{print $1; exit}')
if [[ -z "$tmpl" ]]; then if [[ -z "$tmpl" ]]; then
msg_info "Downloading Ubuntu 22.04 LXC template" msg_info "Downloading Ubuntu 22.04 LXC template" >&2
pveam update &>/dev/null pveam update &>/dev/null || true
pveam download local ubuntu-22.04-standard_22.04-1_amd64.tar.zst &>/dev/null # Resolve the exact filename currently offered (pinned names go stale)
msg_ok "Template downloaded" local avail
tmpl="ubuntu-22.04-standard_22.04-1_amd64.tar.zst" avail=$(pveam available --section system 2>/dev/null \
| awk '/ubuntu-22\.04-standard/{print $2}' | sort -V | tail -1)
[[ -n "$avail" ]] || { msg_error "No ubuntu-22.04 template available via pveam" >&2; exit 1; }
pveam download local "$avail" &>/dev/null || { msg_error "Template download failed" >&2; exit 1; }
msg_ok "Template downloaded" >&2
tmpl="$avail"
fi fi
# Return full path for pct create # Return full path for pct create
echo "local:vztmpl/${tmpl##*/}" echo "local:vztmpl/${tmpl##*/}"