This commit is contained in:
CanbiZ
2025-05-08 14:06:17 +02:00
parent 12796db067
commit a7ef32b29d
2 changed files with 27 additions and 18 deletions

View File

@@ -334,16 +334,21 @@ get_valid_nextid() {
}
cleanup_vmid() {
if qm status $VMID &>/dev/null; then
qm stop $VMID &>/dev/null
qm destroy $VMID &>/dev/null
if [[ -z "${VMID:-}" ]]; then
return
fi
if qm status "$VMID" &>/dev/null; then
qm stop "$VMID" &>/dev/null
qm destroy "$VMID" &>/dev/null
fi
}
cleanup() {
popd >/dev/null
if [[ "$(dirs -p | wc -l)" -gt 1 ]]; then
popd >/dev/null || true
fi
post_update_to_api "done" "none"
rm -rf $TEMP_DIR
[[ -n "${TEMP_DIR:-}" && -d "$TEMP_DIR" ]] && rm -rf "$TEMP_DIR"
}
check_root() {