From da9f1b1209767e89403eb6d59062eac61781f576 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:49:03 +0100 Subject: [PATCH] Update create_lxc.sh --- ct/create_lxc.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ct/create_lxc.sh b/ct/create_lxc.sh index b60758218..4bd488f7e 100644 --- a/ct/create_lxc.sh +++ b/ct/create_lxc.sh @@ -202,19 +202,19 @@ PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}}) # Create container with template integrity check msg_info "Creating LXC Container" -if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then - msg_info "Container creation failed, checking template integrity..." - [[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH" - msg_ok "Template integrity check completed" - - msg_info "Re-downloading LXC Template" - pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null || - { msg_error "A problem occurred while re-downloading the LXC template."; exit 208; } - msg_ok "Re-downloaded LXC Template" - if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then - msg_error "A problem occurred while trying to create container after re-downloading template." - exit 200 + msg_info "Container creation failed, checking template integrity..." + [[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH" + msg_ok "Template integrity check completed" + + msg_info "Re-downloading LXC Template" + pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null || + { msg_error "A problem occurred while re-downloading the LXC template."; exit 208; } + msg_ok "Re-downloaded LXC Template" + + if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then + msg_error "A problem occurred while trying to create container after re-downloading template." + exit 200 + fi fi -fi msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created."