mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
remove swap only if the container exists
This commit is contained in:
parent
98c00ed402
commit
236546ca51
1 changed files with 4 additions and 2 deletions
|
@ -131,8 +131,10 @@ LXC_RESET () {
|
|||
|
||||
LXC_STOP $LXC_NAME
|
||||
|
||||
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
|
||||
if lxc info $LXC_NAME >/dev/null 2>/dev/null; then
|
||||
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
|
||||
fi
|
||||
|
||||
lxc delete $LXC_NAME --force 2>/dev/null
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue