Detect drive first

This commit is contained in:
Bob Mottram 2016-10-27 10:53:56 +01:00
parent 5a8d9de8e1
commit cee929e7a4
1 changed files with 6 additions and 6 deletions

View File

@ -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