Update create_lxc.sh

This commit is contained in:
CanbiZ 2025-07-01 13:38:26 +02:00
parent c7975dc9f0
commit 7a7c8ee716

View File

@ -56,17 +56,20 @@ 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
# Neuer Block
if [[ "$line" =~ ^(dir|lvm|lvmthin|zfspool):[[:space:]]*([a-zA-Z0-9._-]+) ]]; then 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 if [[ " ${CURRENT_CONTENTS[*]} " =~ " $CONTENT " ]]; then
VALID_STORAGES+=("$CURRENT_NAME") VALID_STORAGES+=("$CURRENT_NAME")
fi fi
CURRENT_CONTENTS=() fi
}
CURRENT_NAME="${BASH_REMATCH[2]}" CURRENT_NAME="${BASH_REMATCH[2]}"
CURRENT_CONTENTS=()
continue continue
fi fi
# Content-Zeile
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
@ -76,7 +79,7 @@ function check_storage_support() {
done </etc/pve/storage.cfg done </etc/pve/storage.cfg
# Letzten Block prüfen # Letzten Block prüfen
if [[ -n "$CURRENT_NAME" ]]; 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