quickfix: mapfile for _standard_ mapping

there was an issue, that when debian-12-standard% not available, it uses debian-12-turnkey-xxxx
This commit is contained in:
CanbiZ 2025-08-19 16:24:26 +02:00
parent 304c90a1af
commit 7df1dbaf17

View File

@ -254,7 +254,8 @@ TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION:-}"
# 1. Check local templates first # 1. Check local templates first
msg_info "Searching for template '$TEMPLATE_SEARCH'" msg_info "Searching for template '$TEMPLATE_SEARCH'"
mapfile -t TEMPLATES < <( mapfile -t TEMPLATES < <(
pveam list "$TEMPLATE_STORAGE" | awk -v s="$TEMPLATE_SEARCH" '$1 ~ s {print $1}' | pveam list "$TEMPLATE_STORAGE" |
awk -v s="$TEMPLATE_SEARCH" '$1 ~ s && $1 ~ /-standard_/ {print $1}' |
sed 's/.*\///' | sort -t - -k 2 -V sed 's/.*\///' | sort -t - -k 2 -V
) )
@ -264,8 +265,10 @@ else
msg_info "No local template found, checking online repository" msg_info "No local template found, checking online repository"
pveam update >/dev/null 2>&1 pveam update >/dev/null 2>&1
mapfile -t TEMPLATES < <( mapfile -t TEMPLATES < <(
pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | pveam update >/dev/null 2>&1 &&
sort -t - -k 2 -V pveam available -section system |
sed -n "s/.*\($TEMPLATE_SEARCH.*-standard_.*\)/\1/p" |
sort -t - -k 2 -V
) )
TEMPLATE_SOURCE="online" TEMPLATE_SOURCE="online"
fi fi