aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions8
1 files changed, 6 insertions, 2 deletions
diff --git a/functions b/functions
index a0cea12..5be90c7 100644
--- a/functions
+++ b/functions
@@ -468,11 +468,15 @@ do_unlock_systemd() {
else
IFS=,
if in_array swap ${options[@]}; then
- if ! mkswap /dev/mapper/$name >/dev/null; then
+ # create swap on the device only if no fs signature exists
+ blkid -p "$2" &>/dev/null
+ if (( $? == 2 )) || ! mkswap /dev/mapper/$name >/dev/null; then
failed=1
fi
elif in_array tmp ${options[@]}; then
- if ! mke2fs /dev/mapper/$name >/dev/null; then
+ # create fs on the device only if no fs signature exists
+ blkid -p "$2" &>/dev/null
+ if (( $? == 2 )) || ! mke2fs /dev/mapper/$name >/dev/null; then
failed=1
fi
fi