This commit is contained in:
Bob Mottram 2015-07-04 17:32:25 +01:00
parent 09462456b3
commit 62be11f32c
3 changed files with 11 additions and 11 deletions

View File

@ -3820,7 +3820,7 @@ function backup_to_friends_servers {
echo " cd /home/$MY_USERNAME/.gnupg_fragments" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' no_of_shares=$(ls -afq keyshare.asc.* | wc -l)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' no_of_shares=$((no_of_shares - 2))' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' if [[ ${no_of_shares} > 0 ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' if (( no_of_shares > 0 )); then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' # Pick a share index based on the domain name' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' # This ensures that the same share is always given to the same domain' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
echo ' sharenumstr=$(md5sum <<< "$REMOTE_DOMAIN")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME

View File

@ -233,10 +233,10 @@ function validate_domain_name {
# count the number of dots in the domain name
dots=${TEST_DOMAIN_NAME//[^.]}
no_of_dots=${#dots}
if (( $no_of_dots > 3 )); then
if (( no_of_dots > 3 )); then
TEST_DOMAIN_NAME="The domain $TEST_DOMAIN_NAME has too many subdomains. It should be of the type w.x.y.z, x.y.z or y.z"
fi
if (( $no_of_dots == 0 )); then
if (( no_of_dots == 0 )); then
TEST_DOMAIN_NAME="The domain $TEST_DOMAIN_NAME has no top level domain. It should be of the type w.x.y.z, x.y.z or y.z"
fi
}
@ -254,7 +254,7 @@ function interactive_gpg_from_remote {
# check the number of entries in the file
no_of_servers=$(cat $REMOTE_SERVERS_LIST | wc -l)
if [[ ${no_of_servers} < 3 ]]; then
if (( no_of_servers < 3 )); then
dialog --title "Encryption keys" \
--msgbox 'There must be at least three servers to recover the key' 6 70
return 2
@ -278,9 +278,9 @@ function reconstruct_key {
return
fi
cd /home/$MY_USERNAME/.gnupg_fragments
no_of_shares=$(ls -afq keyshare* | wc -l)
no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
no_of_shares=$((no_of_shares - 2))
if [[ ${no_of_shares} < 4 ]]; then
if (( no_of_shares < 4 )); then
dialog --title "Encryption keys" --msgbox 'Not enough fragments to reconstruct the key' 6 70
exit 7348
fi
@ -319,7 +319,7 @@ function interactive_gpg_from_usb {
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
GPG_USB_DRIVE='/dev/sda1'
if [ ! -b $GPG_USB_DRIVE ]; then
if [[ ${GPG_CTR} > 0 ]]; then
if (( GPG_CTR > 0 )); then
reconstruct_key
return 0
fi
@ -333,7 +333,7 @@ function interactive_gpg_from_usb {
if [ ! -b $GPG_USB_DRIVE ]; then
GPG_USB_DRIVE='/dev/sdd1'
if [ ! -b $GPG_USB_DRIVE ]; then
if [[ ${GPG_CTR} > 0 ]]; then
if (( GPG_CTR > 0 )); then
reconstruct_key
return 0
fi
@ -360,7 +360,7 @@ function interactive_gpg_from_usb {
fi
mount $GPG_USB_DRIVE $GPG_USB_MOUNT
if [ ! "$?" = "0" ]; then
if [[ ${GPG_CTR} > 0 ]]; then
if (( GPG_CTR > 0 )); then
rm -rf $GPG_USB_MOUNT
reconstruct_key
return 0
@ -373,7 +373,7 @@ function interactive_gpg_from_usb {
if [ ! -d $GPG_USB_MOUNT/.gnupg ]; then
if [ ! -d $GPG_USB_MOUNT/.gnupg_fragments ]; then
if [[ ${GPG_CTR} > 0 ]]; then
if (( GPG_CTR > 0 )); then
umount -f $GPG_USB_MOUNT
rm -rf $GPG_USB_MOUNT
reconstruct_key

View File

@ -129,7 +129,7 @@ fi
cd $FRAGMENTS_DIR
no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
no_of_shares=$((no_of_shares - 2))
if [[ ${no_of_shares} == 0 ]]; then
if (( no_of_shares == 0 )); then
echo 'No key fragments were retrieved'
exit 76882
fi