diff options
-rw-r--r-- | functions | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |