Update create_lxc.sh

This commit is contained in:
CanbiZ 2025-07-01 14:57:59 +02:00
parent b99bdd3e1d
commit 7a1d072053

View File

@ -56,24 +56,19 @@ function check_storage_support() {
local CURRENT_NAME="" CURRENT_CONTENTS=() local CURRENT_NAME="" CURRENT_CONTENTS=()
while IFS= read -r line || [[ -n "$line" ]]; do while IFS= read -r line || [[ -n "$line" ]]; do
# Prüfen auf Storage-Typ-Zeile (dir:, lvm:, lvmthin:, zfspool:) # Neue Storage-Definition erkannt
if [[ "$line" =~ ^(dir|lvm|lvmthin|zfspool):[[:space:]]*([a-zA-Z0-9._-]+) ]]; then if [[ "$line" =~ ^[[:space:]]*(dir|lvm|lvmthin|zfspool):[[:space:]]*([a-zA-Z0-9._-]+) ]]; then
if [[ -n "$CURRENT_NAME" && "${#CURRENT_CONTENTS[@]}" -gt 0 ]]; then if [[ -n "$CURRENT_NAME" && "${#CURRENT_CONTENTS[@]}" -gt 0 ]]; then
if [[ " ${CURRENT_CONTENTS[*]} " =~ " $CONTENT " ]]; then if [[ " ${CURRENT_CONTENTS[*]} " =~ " $CONTENT " ]]; then
VALID_STORAGES+=("$CURRENT_NAME") VALID_STORAGES+=("$CURRENT_NAME")
fi fi
fi fi
CURRENT_NAME="${BASH_REMATCH[2]}"
# Nur wenn der Regex gematcht hat, darf man auf BASH_REMATCH zugreifen CURRENT_CONTENTS=()
CURRENT_NAME=""
if [[ ${#BASH_REMATCH[@]} -ge 3 ]]; then
CURRENT_NAME="${BASH_REMATCH[2]}"
CURRENT_CONTENTS=()
fi
continue continue
fi fi
# Content-Zeile # Content-Zeile erkannt
if [[ "$line" =~ ^[[:space:]]*content[[:space:]]*=?[[:space:]]*(.+)$ ]]; then if [[ "$line" =~ ^[[:space:]]*content[[:space:]]*=?[[:space:]]*(.+)$ ]]; then
IFS=',' read -ra PARTS <<<"${BASH_REMATCH[1]}" IFS=',' read -ra PARTS <<<"${BASH_REMATCH[1]}"
for c in "${PARTS[@]}"; do for c in "${PARTS[@]}"; do