From cee929e7a4f9ac9bbe28db13de1c6e14ce1569d2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 27 Oct 2016 10:53:56 +0100 Subject: [PATCH] Detect drive first --- src/freedombone-config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/freedombone-config b/src/freedombone-config index 43962718..7f3f89fe 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -964,7 +964,9 @@ function interactive_gpg_from_usb { GPG_CTR=0 while [[ $GPG_LOADING == "yes" ]] do - if [ ! -b $GPG_USB_DRIVE ]; then + detect_usb_drive + + if [ ! -b $USB_DRIVE ]; then if (( GPG_CTR > 0 )); then reconstruct_key return 0 @@ -973,8 +975,6 @@ function interactive_gpg_from_usb { exit 739836 fi - detect_usb_drive - GPG_USB_DRIVE=$USB_DRIVE GPG_USB_MOUNT='/mnt/usb' umount -f $GPG_USB_MOUNT if [ ! -d $GPG_USB_MOUNT ]; then @@ -985,11 +985,11 @@ function interactive_gpg_from_usb { rm -rf /dev/mapper/encrypted_usb fi cryptsetup luksClose encrypted_usb - cryptsetup luksOpen $GPG_USB_DRIVE encrypted_usb + cryptsetup luksOpen $USB_DRIVE encrypted_usb if [ "$?" = "0" ]; then - GPG_USB_DRIVE=/dev/mapper/encrypted_usb + USB_DRIVE=/dev/mapper/encrypted_usb fi - mount $GPG_USB_DRIVE $GPG_USB_MOUNT + mount $USB_DRIVE $GPG_USB_MOUNT if [ ! "$?" = "0" ]; then if (( GPG_CTR > 0 )); then rm -rf $GPG_USB_MOUNT