From 6f4ac74113e16234129b382d4f9bb462b604fc93 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:08:39 +0200 Subject: [PATCH] Update create_lxc.sh --- misc/create_lxc.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/misc/create_lxc.sh b/misc/create_lxc.sh index 5b792c6e..88820aa8 100644 --- a/misc/create_lxc.sh +++ b/misc/create_lxc.sh @@ -106,23 +106,41 @@ function select_storage() { exit 221 } + # Gather valid storages from /etc/pve/storage.cfg + local -a VALID_STORAGES=() + local CURRENT_STORAGE="" + while read -r LINE; do + if [[ "$LINE" =~ ^(dir|lvm|lvmthin|zfspool|.*):[[:space:]]*(.+)$ ]]; then + CURRENT_STORAGE="${BASH_REMATCH[2]}" + elif [[ "$LINE" =~ ^[[:space:]]*content[[:space:]]*=[[:space:]]*(.+)$ ]]; then + [[ ",${BASH_REMATCH[1]}," =~ ,$CONTENT, ]] && VALID_STORAGES+=("$CURRENT_STORAGE") + fi + done COL_WIDTH)) && COL_WIDTH=${#DISPLAY} done < <(pvesm status -content "$CONTENT" | awk 'NR>1') if [ ${#MENU[@]} -eq 0 ]; then - msg_error "No storage found for content type '$CONTENT'." + msg_error "No storage found that supports '${CONTENT}'." exit 203 fi