Update create_lxc.sh

This commit is contained in:
CanbiZ 2025-08-22 11:58:19 +02:00
parent 262b93f154
commit 7eec53900f

View File

@ -245,13 +245,18 @@ if ! grep -qw "rootdir" <<<"$STORAGE_CONTENT"; then
msg_error "Storage '$CONTAINER_STORAGE' does not support 'rootdir'. Cannot create LXC." msg_error "Storage '$CONTAINER_STORAGE' does not support 'rootdir'. Cannot create LXC."
exit 217 exit 217
fi fi
msg_ok "Storage '$CONTAINER_STORAGE' supports 'rootdir'"
# check if template storage is compatible # check if template storage is compatible
msg_info "Validating content types of template storage '$TEMPLATE_STORAGE'"
TEMPLATE_CONTENT=$(grep -A4 -E "^[^:]+: $TEMPLATE_STORAGE" /etc/pve/storage.cfg | grep content | awk '{$1=""; print $0}' | xargs) TEMPLATE_CONTENT=$(grep -A4 -E "^[^:]+: $TEMPLATE_STORAGE" /etc/pve/storage.cfg | grep content | awk '{$1=""; print $0}' | xargs)
msg_debug "Template storage '$TEMPLATE_STORAGE' has content types: $TEMPLATE_CONTENT" msg_debug "Template storage '$TEMPLATE_STORAGE' has content types: $TEMPLATE_CONTENT"
if ! grep -qw "vztmpl" <<<"$TEMPLATE_CONTENT"; then if ! grep -qw "vztmpl" <<<"$TEMPLATE_CONTENT"; then
msg_warn "Template storage '$TEMPLATE_STORAGE' does not declare 'vztmpl'. This may cause pct create to fail." msg_warn "Template storage '$TEMPLATE_STORAGE' does not declare 'vztmpl'. This may cause pct create to fail."
else
msg_ok "Template storage '$TEMPLATE_STORAGE' supports 'vztmpl'"
fi fi
# Check free space on selected container storage # Check free space on selected container storage