From b743b30b61789e40c4716055eb3669f20b20d131 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:45:33 +0200 Subject: [PATCH] destroy_lxc --- install/swizzin-install.sh | 1 + misc/core.func | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/install/swizzin-install.sh b/install/swizzin-install.sh index 6d638083..d59e1dde 100644 --- a/install/swizzin-install.sh +++ b/install/swizzin-install.sh @@ -21,6 +21,7 @@ echo read -r -p "${TAB3}Do you want to continue? [y/N]: " CONFIRM if [[ ! "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then msg_error "Aborted by user. No changes have been made." + destroy_lxc exit 1 fi bash <(curl -sL s5n.sh) diff --git a/misc/core.func b/misc/core.func index 5df50efd..1c56d1de 100644 --- a/misc/core.func +++ b/misc/core.func @@ -449,3 +449,18 @@ check_or_create_swap() { } trap 'stop_spinner' EXIT INT TERM + +destroy_lxc() { + if [[ -n "$CT_ID" ]]; then + read -p "Remove this Container? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + pct stop "$CT_ID" &>/dev/null + pct destroy "$CT_ID" &>/dev/null + msg_ok "Removed this Container" + else + msg_info "Container was not removed." + fi + else + msg_error "No CT_ID found. Nothing to remove." + fi +}