From 4012dd3dcd85d86066dce11b8c014c7bbb5b8116 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 4 Jul 2025 14:45:01 +0200 Subject: [PATCH] Update create_lxc.sh --- misc/create_lxc.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/misc/create_lxc.sh b/misc/create_lxc.sh index f984269f..7a10a916 100644 --- a/misc/create_lxc.sh +++ b/misc/create_lxc.sh @@ -146,24 +146,28 @@ function select_storage() { local WIDTH=$((COL_WIDTH + 42)) local DISPLAY_SELECTED="" while true; do - DISPLAY_SELECTED=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ - "Which storage pool for ${CONTENT_LABEL,,}?\n(Spacebar to select)" \ + DISPLAY_SELECTED=$(whiptail --backtitle "Proxmox VE Helper Scripts" \ + --title "Storage Pools" \ + --radiolist "Which storage pool for ${CONTENT_LABEL,,}?\n(Spacebar to select)" \ 16 "$WIDTH" 6 "${MENU[@]}" 3>&1 1>&2 2>&3) - local ret=$? - if [[ $ret -ne 0 ]]; then + local exit_code=$? + if [ $exit_code -ne 0 ]; then msg_error "Storage selection cancelled by user." exit 202 fi - if [[ -z "$DISPLAY_SELECTED" || -z "${STORAGE_MAP[$DISPLAY_SELECTED]+_}" ]]; then - whiptail --backtitle "Proxmox VE Helper Scripts" --title "Invalid Selection" \ - --msgbox "No valid storage selected. Please choose a storage pool to continue." 9 60 + if [ -z "$DISPLAY_SELECTED" ]; then + whiptail --msgbox "You must select a storage pool to continue." 8 58 continue fi - echo "${STORAGE_MAP[$DISPLAY_SELECTED]}" - return + if [[ -n "${STORAGE_MAP[$DISPLAY_SELECTED]:-}" ]]; then + echo "${STORAGE_MAP[$DISPLAY_SELECTED]}" + return + else + whiptail --msgbox "Invalid selection. Please try again." 8 58 + fi done }