From 3ce47157bdc793561f9ac5608e9288d7ba1d28e0 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Jul 2025 15:02:46 +0200 Subject: [PATCH] Update create_lxc.sh --- misc/create_lxc.sh | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/misc/create_lxc.sh b/misc/create_lxc.sh index 4ae2b0f8..7df5022d 100644 --- a/misc/create_lxc.sh +++ b/misc/create_lxc.sh @@ -53,33 +53,12 @@ function on_terminate() { function check_storage_support() { local CONTENT="$1" local -a VALID_STORAGES=() - local CURRENT_NAME="" CURRENT_CONTENTS=() - while IFS= read -r line || [[ -n "$line" ]]; do - # Prüfen auf neue Storage-Definition (nur bei erfolgreichem Match BASH_REMATCH verwenden!) - if [[ "$line" =~ ^[[:space:]]*(dir|lvm|lvmthin|zfspool):[[:space:]]*([a-zA-Z0-9._-]+) ]]; then - # vorherigen Block prüfen - if [[ -n "$CURRENT_NAME" && "${#CURRENT_CONTENTS[@]}" -gt 0 ]]; then - if [[ " ${CURRENT_CONTENTS[*]} " =~ " $CONTENT " ]]; then - VALID_STORAGES+=("$CURRENT_NAME") - fi - fi - CURRENT_NAME="${BASH_REMATCH[2]}" - CURRENT_CONTENTS=() - elif [[ "$line" =~ ^[[:space:]]*content[[:space:]]*=?[[:space:]]*(.+)$ ]]; then - IFS=',' read -ra PARTS <<<"${BASH_REMATCH[1]}" - for c in "${PARTS[@]}"; do - CURRENT_CONTENTS+=("$(echo "$c" | xargs)") - done - fi - done /dev/null | awk 'NR>1') [[ ${#VALID_STORAGES[@]} -gt 0 ]] }