Update build.func
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled

This commit is contained in:
CanbiZ 2025-10-21 15:06:39 +02:00
parent 6866830633
commit 78835a3903

View File

@ -3007,12 +3007,15 @@ create_lxc_container() {
pveam update >/dev/null 2>&1 || msg_warn "Could not update template catalog (pveam update failed)." pveam update >/dev/null 2>&1 || msg_warn "Could not update template catalog (pveam update failed)."
mapfile -t ONLINE_TEMPLATES < <( mapfile -t ONLINE_TEMPLATES < <(
pveam available -section system 2>/dev/null | pveam available -section system 2>/dev/null |
grep -E "^${TEMPLATE_SEARCH}-.*${TEMPLATE_PATTERN}" | grep -E "^${TEMPLATE_SEARCH}.*${TEMPLATE_PATTERN}" |
sort -t - -k 2 -V sort -t - -k 2 -V
) )
ONLINE_TEMPLATE="" ONLINE_TEMPLATE=""
[[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}" [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}"
msg_debug "Found ${#LOCAL_TEMPLATES[@]} local templates, ${#ONLINE_TEMPLATES[@]} online templates"
msg_debug "ONLINE_TEMPLATE='$ONLINE_TEMPLATE'"
if [[ ${#LOCAL_TEMPLATES[@]} -gt 0 ]]; then if [[ ${#LOCAL_TEMPLATES[@]} -gt 0 ]]; then
TEMPLATE="${LOCAL_TEMPLATES[-1]}" TEMPLATE="${LOCAL_TEMPLATES[-1]}"
TEMPLATE_SOURCE="local" TEMPLATE_SOURCE="local"
@ -3021,6 +3024,8 @@ create_lxc_container() {
TEMPLATE_SOURCE="online" TEMPLATE_SOURCE="online"
fi fi
echo -e "Selected TEMPLATE='$TEMPLATE' SOURCE='$TEMPLATE_SOURCE'"
TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || true)" TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || true)"
if [[ -z "$TEMPLATE_PATH" ]]; then if [[ -z "$TEMPLATE_PATH" ]]; then
TEMPLATE_BASE=$(awk -v s="$TEMPLATE_STORAGE" '$1==s {f=1} f && /path/ {print $2; exit}' /etc/pve/storage.cfg) TEMPLATE_BASE=$(awk -v s="$TEMPLATE_STORAGE" '$1==s {f=1} f && /path/ {print $2; exit}' /etc/pve/storage.cfg)
@ -3068,7 +3073,7 @@ create_lxc_container() {
) )
mapfile -t ONLINE_TEMPLATES < <( mapfile -t ONLINE_TEMPLATES < <(
pveam available -section system 2>/dev/null | pveam available -section system 2>/dev/null |
grep -E "^${TEMPLATE_SEARCH}-.*${TEMPLATE_PATTERN}" | grep -E "^${TEMPLATE_SEARCH}.*${TEMPLATE_PATTERN}" |
sort -t - -k 2 -V sort -t - -k 2 -V
) )
ONLINE_TEMPLATE="" ONLINE_TEMPLATE=""