remove existing swap file

This commit is contained in:
Tobias Powalowski 2024-06-06 11:18:56 +02:00
parent fabb98183d
commit 2681aab191

View file

@ -455,6 +455,8 @@ _mkfs() {
if echo "${1}" | grep -q '^/dev'; then
mkswap -L "${6}" "${1}" &>"${_LOG}" || : >/tmp/.mp-error
else
# remove existing swap file
[[ -f "${3}${1}" ]] && rm "${3}${1}"
mkswap "${7}" -U clear -L "${6}" -F "${3}${1}" &>"${_LOG}" || : >/tmp/.mp-error
# btrfs needs NO_COW attribute
chattr +C "${3}${1}" &>"${_LOG}"