Bob Mottram 10 years ago
parent
commit
62be11f32c
3 changed files with 11 additions and 11 deletions
  1. 1
    1
      src/freedombone
  2. 9
    9
      src/freedombone-config
  3. 1
    1
      src/freedombone-recoverkey

+ 1
- 1
src/freedombone View File

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

+ 9
- 9
src/freedombone-config View File

233
   # count the number of dots in the domain name
233
   # count the number of dots in the domain name
234
   dots=${TEST_DOMAIN_NAME//[^.]}
234
   dots=${TEST_DOMAIN_NAME//[^.]}
235
   no_of_dots=${#dots}
235
   no_of_dots=${#dots}
236
-  if (( $no_of_dots > 3 )); then
236
+  if (( no_of_dots > 3 )); then
237
       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"
237
       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"
238
   fi
238
   fi
239
-  if (( $no_of_dots == 0 )); then
239
+  if (( no_of_dots == 0 )); then
240
       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"
240
       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"
241
   fi
241
   fi
242
 }
242
 }
254
 
254
 
255
   # check the number of entries in the file
255
   # check the number of entries in the file
256
   no_of_servers=$(cat $REMOTE_SERVERS_LIST | wc -l)
256
   no_of_servers=$(cat $REMOTE_SERVERS_LIST | wc -l)
257
-  if [[ ${no_of_servers} < 3 ]]; then
257
+  if (( no_of_servers < 3 )); then
258
       dialog --title "Encryption keys" \
258
       dialog --title "Encryption keys" \
259
              --msgbox 'There must be at least three servers to recover the key' 6 70
259
              --msgbox 'There must be at least three servers to recover the key' 6 70
260
       return 2
260
       return 2
278
         return
278
         return
279
     fi
279
     fi
280
     cd /home/$MY_USERNAME/.gnupg_fragments
280
     cd /home/$MY_USERNAME/.gnupg_fragments
281
-    no_of_shares=$(ls -afq keyshare* | wc -l)
281
+    no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
282
     no_of_shares=$((no_of_shares - 2))
282
     no_of_shares=$((no_of_shares - 2))
283
-    if [[ ${no_of_shares} < 4 ]]; then
283
+    if (( no_of_shares < 4 )); then
284
         dialog --title "Encryption keys" --msgbox 'Not enough fragments to reconstruct the key' 6 70
284
         dialog --title "Encryption keys" --msgbox 'Not enough fragments to reconstruct the key' 6 70
285
         exit 7348
285
         exit 7348
286
     fi
286
     fi
319
       if [[ $INSTALLING_ON_BBB == "yes" ]]; then
319
       if [[ $INSTALLING_ON_BBB == "yes" ]]; then
320
           GPG_USB_DRIVE='/dev/sda1'
320
           GPG_USB_DRIVE='/dev/sda1'
321
           if [ ! -b $GPG_USB_DRIVE ]; then
321
           if [ ! -b $GPG_USB_DRIVE ]; then
322
-              if [[ ${GPG_CTR} > 0 ]]; then
322
+              if (( GPG_CTR > 0 )); then
323
                   reconstruct_key
323
                   reconstruct_key
324
                   return 0
324
                   return 0
325
               fi
325
               fi
333
               if [ ! -b $GPG_USB_DRIVE ]; then
333
               if [ ! -b $GPG_USB_DRIVE ]; then
334
                   GPG_USB_DRIVE='/dev/sdd1'
334
                   GPG_USB_DRIVE='/dev/sdd1'
335
                   if [ ! -b $GPG_USB_DRIVE ]; then
335
                   if [ ! -b $GPG_USB_DRIVE ]; then
336
-                      if [[ ${GPG_CTR} > 0 ]]; then
336
+                      if (( GPG_CTR > 0 )); then
337
                           reconstruct_key
337
                           reconstruct_key
338
                           return 0
338
                           return 0
339
                       fi
339
                       fi
360
       fi
360
       fi
361
       mount $GPG_USB_DRIVE $GPG_USB_MOUNT
361
       mount $GPG_USB_DRIVE $GPG_USB_MOUNT
362
       if [ ! "$?" = "0" ]; then
362
       if [ ! "$?" = "0" ]; then
363
-          if [[ ${GPG_CTR} > 0 ]]; then
363
+          if (( GPG_CTR > 0 )); then
364
               rm -rf $GPG_USB_MOUNT
364
               rm -rf $GPG_USB_MOUNT
365
               reconstruct_key
365
               reconstruct_key
366
               return 0
366
               return 0
373
 
373
 
374
       if [ ! -d $GPG_USB_MOUNT/.gnupg ]; then
374
       if [ ! -d $GPG_USB_MOUNT/.gnupg ]; then
375
           if [ ! -d $GPG_USB_MOUNT/.gnupg_fragments ]; then
375
           if [ ! -d $GPG_USB_MOUNT/.gnupg_fragments ]; then
376
-              if [[ ${GPG_CTR} > 0 ]]; then
376
+              if (( GPG_CTR > 0 )); then
377
                   umount -f $GPG_USB_MOUNT
377
                   umount -f $GPG_USB_MOUNT
378
                   rm -rf $GPG_USB_MOUNT
378
                   rm -rf $GPG_USB_MOUNT
379
                   reconstruct_key
379
                   reconstruct_key

+ 1
- 1
src/freedombone-recoverkey View File

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