Fix Proxmox script: detect debian-12 template dynamically

The hardcoded template version (12.7-1) no longer exists on the
mirror, causing "no such template" errors. Resolve the latest
available debian-12-standard template instead of pinning a version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik Thiele
2026-07-19 19:34:08 +02:00
parent a7c5866a24
commit 468f9872c1

View File

@@ -54,12 +54,18 @@ echo "==> Netzwerk: $CT_BRIDGE / $CT_IP"
# ---------------------------------------------------------------------------
# Debian-12-Template sicherstellen
# ---------------------------------------------------------------------------
TEMPLATE="debian-12-standard_12.7-1_amd64.tar.zst"
if ! pveam list "$TEMPLATE_STORAGE" | grep -q "$TEMPLATE"; then
TEMPLATE="$(pveam list "$TEMPLATE_STORAGE" | awk '{print $1}' | grep -o 'debian-12-standard_[^ ]*\.tar\.zst' | sort -V | tail -n1)"
if [ -z "$TEMPLATE" ]; then
echo "==> Lade Debian-12-Template herunter..."
pveam update
TEMPLATE="$(pveam available --section system | awk '{print $2}' | grep '^debian-12-standard_.*\.tar\.zst$' | sort -V | tail -n1)"
if [ -z "$TEMPLATE" ]; then
echo "Fehler: Kein debian-12-standard-Template in 'pveam available' gefunden." >&2
exit 1
fi
pveam download "$TEMPLATE_STORAGE" "$TEMPLATE"
fi
echo "==> Verwende Template: $TEMPLATE"
# ---------------------------------------------------------------------------
# LXC-Container anlegen