Move out of the target directory before unmounting

This commit is contained in:
Bob Mottram 2015-07-05 10:23:34 +01:00
parent a608e1f281
commit b31a107de6
1 changed files with 5 additions and 1 deletions

View File

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