From b31a107de6282168b659836d70b4be74f865abd8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 5 Jul 2015 10:23:34 +0100 Subject: [PATCH] Move out of the target directory before unmounting --- src/freedombone-keydrive | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/freedombone-keydrive b/src/freedombone-keydrive index b75a2950..7f94983f 100755 --- a/src/freedombone-keydrive +++ b/src/freedombone-keydrive @@ -132,6 +132,7 @@ FRAGMENTS_DIR=$FRAGMENTS_DIR/$MY_USERNAME # make a directory to contain the fragments if [ ! -d $FRAGMENTS_DIR ]; then mkdir -p $FRAGMENTS_DIR + echo "Made directory $FRAGMENTS_DIR" fi if [ ! -d $FRAGMENTS_DIR ]; then echo "There was a problem making the directory $FRAGMENTS_DIR" @@ -170,7 +171,7 @@ else fi if (( no_of_local_shares < 3 )); then freedombone-splitkey -u $MY_USERNAME - cd $LOCAL_FRAGMENTS_DIR + cd $LOCAL_FRAGMENTS_DIR no_of_local_shares=$(ls -afq keyshare.asc.* | wc -l) if [ ! "$?" = "0" ]; then no_of_local_shares=0 @@ -196,6 +197,7 @@ no_of_usb_shares=$((no_of_usb_shares - 2)) if (( no_of_usb_shares > 1 )); then echo "Too many key fragments exist in $FRAGMENTS_DIR" ls $FRAGMENTS_DIR + cd ~/ umount -f $USB_MOUNT rm -rf $USB_MOUNT exit 54292 @@ -203,10 +205,12 @@ fi if (( no_of_usb_shares <= 0 )); then echo "There was a problem copying the key fragment to $USB_DRIVE" ls $FRAGMENTS_DIR + cd ~/ umount -f $USB_MOUNT rm -rf $USB_MOUNT exit 54292 fi +cd ~/ umount -f $USB_MOUNT rm -rf $USB_MOUNT echo "Key fragment copied to $USB_DRIVE. You may now remove the drive."