From 98c00ed40270d72746be9ac1864ac8ad3cdd3b37 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 5 Jul 2022 14:22:29 +0200 Subject: [PATCH] [fix] get the current storage of a container instead of using "default" --- lib/lxc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lxc.sh b/lib/lxc.sh index 2bc9165..a914251 100644 --- a/lib/lxc.sh +++ b/lib/lxc.sh @@ -131,7 +131,8 @@ LXC_RESET () { LXC_STOP $LXC_NAME - swapoff "$(lxc storage get default source)/containers/$LXC_NAME/rootfs/swap" 2>/dev/null + local current_storage=$(lxc list $LXC_NAME --format json --columns b | jq '.[].expanded_devices.root.pool') + swapoff "$(lxc storage get $current_storage source)/containers/$LXC_NAME/rootfs/swap" 2>/dev/null lxc delete $LXC_NAME --force 2>/dev/null }