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