Fix Proxmox script to find template dynamically
Instead of hardcoding the template name, now searches for the latest available Debian 12 template. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+15
-3
@@ -94,12 +94,24 @@ fi
|
|||||||
|
|
||||||
# Download Debian template if not exists
|
# Download Debian template if not exists
|
||||||
header "Checking Container Template"
|
header "Checking Container Template"
|
||||||
TEMPLATE="debian-12-standard_12.7-1_amd64.tar.zst"
|
|
||||||
|
msg "Updating template list..."
|
||||||
|
pveam update
|
||||||
|
|
||||||
|
# Find the latest Debian 12 template
|
||||||
|
TEMPLATE=$(pveam available --section system | grep "debian-12-standard" | tail -1 | awk '{print $2}')
|
||||||
|
|
||||||
|
if [ -z "$TEMPLATE" ]; then
|
||||||
|
error "Could not find Debian 12 template. Available templates:"
|
||||||
|
pveam available --section system
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "Using template: $TEMPLATE"
|
||||||
TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE"
|
TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE"
|
||||||
|
|
||||||
if [ ! -f "$TEMPLATE_PATH" ]; then
|
if [ ! -f "$TEMPLATE_PATH" ]; then
|
||||||
msg "Downloading Debian 12 template..."
|
msg "Downloading $TEMPLATE..."
|
||||||
pveam update
|
|
||||||
pveam download $TEMPLATE_STORAGE $TEMPLATE
|
pveam download $TEMPLATE_STORAGE $TEMPLATE
|
||||||
else
|
else
|
||||||
msg "Template already exists"
|
msg "Template already exists"
|
||||||
|
|||||||
Reference in New Issue
Block a user