From 7a7c8ee7160f56a56f58631dd437a42410b67fa9 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:38:26 +0200 Subject: [PATCH] Update create_lxc.sh --- misc/create_lxc.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/misc/create_lxc.sh b/misc/create_lxc.sh index 910e3df4..f5b7518b 100644 --- a/misc/create_lxc.sh +++ b/misc/create_lxc.sh @@ -56,17 +56,20 @@ function check_storage_support() { local CURRENT_NAME="" CURRENT_CONTENTS=() while IFS= read -r line || [[ -n "$line" ]]; do + # Neuer Block if [[ "$line" =~ ^(dir|lvm|lvmthin|zfspool):[[:space:]]*([a-zA-Z0-9._-]+) ]]; then - [[ -n "$CURRENT_NAME" ]] && { + # Wenn vorheriger Block gültig war, prüfen + if [[ -n "$CURRENT_NAME" && "${#CURRENT_CONTENTS[@]}" -gt 0 ]]; then if [[ " ${CURRENT_CONTENTS[*]} " =~ " $CONTENT " ]]; then VALID_STORAGES+=("$CURRENT_NAME") fi - CURRENT_CONTENTS=() - } + fi CURRENT_NAME="${BASH_REMATCH[2]}" + CURRENT_CONTENTS=() continue fi + # Content-Zeile if [[ "$line" =~ ^[[:space:]]*content[[:space:]]*=?[[:space:]]*(.+)$ ]]; then IFS=',' read -ra PARTS <<<"${BASH_REMATCH[1]}" for c in "${PARTS[@]}"; do @@ -76,7 +79,7 @@ function check_storage_support() { done