From b3fcb5addffccb6b32573363f4a7270cef272ea3 Mon Sep 17 00:00:00 2001 From: vhsdream Date: Wed, 22 Oct 2025 17:07:58 -0400 Subject: [PATCH] Tweak template search debug test to avoid unbound var --- misc/build.func | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/build.func b/misc/build.func index 016279e0..a7336f82 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2999,7 +2999,7 @@ create_lxc_container() { msg_info "Searching for template '$TEMPLATE_SEARCH'" # Build regex patterns outside awk/grep for clarity - SEARCH_PATTERN="^${TEMPLATE_SEARCH}-" + SEARCH_PATTERN="^${TEMPLATE_SEARCH}" echo "[DEBUG] TEMPLATE_SEARCH='$TEMPLATE_SEARCH'" echo "[DEBUG] SEARCH_PATTERN='$SEARCH_PATTERN'" @@ -3016,9 +3016,11 @@ create_lxc_container() { echo "[DEBUG] pveam available output (first 5 lines with .tar files):" pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | head -5 | sed 's/^/ /' + set +u mapfile -t ONLINE_TEMPLATES \ \ - echo "[DEBUG] After filtering: ${#ONLINE_TEMPLATES[@]} online templates found" < <(pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | awk -F'\t' '{print $1}' | grep -E "${SEARCH_PATTERN}.*${TEMPLATE_PATTERN}" | sort -t - -k 2 -V 2>/dev/null || true) + echo "[DEBUG] After filtering: ${#ONLINE_TEMPLATES[@]} online templates found" < <(pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | awk '{print $2}' | grep -E "${SEARCH_PATTERN}.*${TEMPLATE_PATTERN}" | sort -t - -k 2 -V 2>/dev/null || true) + set -u if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then echo "[DEBUG] Online templates:" for tmpl in "${ONLINE_TEMPLATES[@]}"; do