Bob Mottram 9 anos atrás
pai
commit
5039a5526e
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5
    3
      src/freedombone-format

+ 5
- 3
src/freedombone-format Ver arquivo

@@ -34,24 +34,26 @@ if [ ! $1 ]; then
34 34
    exit 1
35 35
 fi
36 36
 
37
-USB_DRIVE=/dev/$1
37
+USB_DRIVE=/dev/${1}
38 38
 
39 39
 echo "Formatting $USB_DRIVE as LUKS"
40
-cryptsetup -y -v luksFormat $USB_DRIVE
40
+cryptsetup -y -v luksFormat ${USB_DRIVE}
41 41
 if [ ! "$?" = "0" ]; then
42 42
     echo "Failed to format $USB_DRIVE as LUKS"
43 43
     exit 36823
44 44
 fi
45
-cryptsetup luksOpen $USB_DRIVE encrypted_usb
45
+cryptsetup luksOpen ${USB_DRIVE} encrypted_usb
46 46
 if [ ! "$?" = "0" ]; then
47 47
     echo "Failed to open LUKS formatted drive $USB_DRIVE"
48 48
     exit 37232
49 49
 fi
50 50
 mkfs.ext4 /dev/mapper/encrypted_usb
51 51
 if [ ! "$?" = "0" ]; then
52
+    cryptsetup luksClose encrypted_usb
52 53
     echo 'Format of drive $USB_DRIVE failed'
53 54
     exit 73218
54 55
 fi
56
+sleep 2
55 57
 cryptsetup luksClose encrypted_usb
56 58
 if [ -f /dev/mapper/encrypted_usb ]; then
57 59
     rm -rf /dev/mapper/encrypted_usb