Fixing keydrive creation

This commit is contained in:
Bob Mottram 2015-07-05 10:45:00 +01:00
parent b31a107de6
commit c11f5ce894
1 changed files with 9 additions and 11 deletions

View File

@ -145,11 +145,10 @@ cd $FRAGMENTS_DIR
no_of_usb_shares=$(ls -afq keyshare.asc.* | wc -l)
if [ ! "$?" = "0" ]; then
no_of_usb_shares=0
else
no_of_usb_shares=$((no_of_usb_shares - 2))
fi
if (( no_of_usb_shares > 0 )); then
echo "A key fragment already exists on the drive for the user $MY_USERNAME"
cd ~/
umount -f $USB_MOUNT
rm -rf $USB_MOUNT
exit 58945
@ -166,8 +165,6 @@ cd $LOCAL_FRAGMENTS_DIR
no_of_local_shares=$(ls -afq keyshare.asc.* | wc -l)
if [ ! "$?" = "0" ]; then
no_of_local_shares=0
else
no_of_local_shares=$((no_of_local_shares - 2))
fi
if (( no_of_local_shares < 3 )); then
freedombone-splitkey -u $MY_USERNAME
@ -175,13 +172,12 @@ if (( no_of_local_shares < 3 )); then
no_of_local_shares=$(ls -afq keyshare.asc.* | wc -l)
if [ ! "$?" = "0" ]; then
no_of_local_shares=0
else
no_of_local_shares=$((no_of_local_shares - 2))
fi
fi
if (( no_of_local_shares < 3 )); then
echo "Not enough key fragments available ${no_of_local_shares}"
cd ~/
umount -f $USB_MOUNT
rm -rf $USB_MOUNT
exit 63386
@ -193,7 +189,7 @@ SHARE_FILENAME=${share_files[RANDOM % ${#share_files[@]}]}
cp -f $SHARE_FILENAME $FRAGMENTS_DIR
cd $FRAGMENTS_DIR
no_of_usb_shares=$(ls -afq keyshare.asc.* | wc -l)
no_of_usb_shares=$((no_of_usb_shares - 2))
echo "Number of fragments on the drive: ${no_of_usb_shares}"
if (( no_of_usb_shares > 1 )); then
echo "Too many key fragments exist in $FRAGMENTS_DIR"
ls $FRAGMENTS_DIR
@ -204,12 +200,14 @@ if (( no_of_usb_shares > 1 )); then
fi
if (( no_of_usb_shares <= 0 )); then
echo "There was a problem copying the key fragment to $USB_DRIVE"
echo "Files found: ${no_of_usb_shares}"
ls $FRAGMENTS_DIR
cd ~/
umount -f $USB_MOUNT
rm -rf $USB_MOUNT
exit 54292
fi
cd ~/
umount -f $USB_MOUNT
rm -rf $USB_MOUNT