From 5039a5526e30bfd905f91f0f3c05b8ede6d40ad3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Nov 2015 21:05:24 +0000 Subject: [PATCH] Tweaks --- src/freedombone-format | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/freedombone-format b/src/freedombone-format index ae59bd18..ef1b90f6 100755 --- a/src/freedombone-format +++ b/src/freedombone-format @@ -34,24 +34,26 @@ if [ ! $1 ]; then exit 1 fi -USB_DRIVE=/dev/$1 +USB_DRIVE=/dev/${1} echo "Formatting $USB_DRIVE as LUKS" -cryptsetup -y -v luksFormat $USB_DRIVE +cryptsetup -y -v luksFormat ${USB_DRIVE} if [ ! "$?" = "0" ]; then echo "Failed to format $USB_DRIVE as LUKS" exit 36823 fi -cryptsetup luksOpen $USB_DRIVE encrypted_usb +cryptsetup luksOpen ${USB_DRIVE} encrypted_usb if [ ! "$?" = "0" ]; then echo "Failed to open LUKS formatted drive $USB_DRIVE" exit 37232 fi mkfs.ext4 /dev/mapper/encrypted_usb if [ ! "$?" = "0" ]; then + cryptsetup luksClose encrypted_usb echo 'Format of drive $USB_DRIVE failed' exit 73218 fi +sleep 2 cryptsetup luksClose encrypted_usb if [ -f /dev/mapper/encrypted_usb ]; then rm -rf /dev/mapper/encrypted_usb