Bläddra i källkod

Option to install on systems other than the Beaglebone Black

Bob Mottram 10 år sedan
förälder
incheckning
b60210b966
1 ändrade filer med 31 tillägg och 13 borttagningar
  1. 31
    13
      install-freedombone.sh

+ 31
- 13
install-freedombone.sh Visa fil

64
 FREEDNS_SUBDOMAIN_CODE=$3
64
 FREEDNS_SUBDOMAIN_CODE=$3
65
 SYSTEM_TYPE=$4
65
 SYSTEM_TYPE=$4
66
 
66
 
67
+# Are we installing on a Beaglebone Black (BBB) or some other system?
68
+INSTALLING_ON_BBB="yes"
69
+
67
 # Different system variants which may be specified within
70
 # Different system variants which may be specified within
68
 # the SYSTEM_TYPE option
71
 # the SYSTEM_TYPE option
69
 VARIANT_WRITER="writer"
72
 VARIANT_WRITER="writer"
75
 VARIANT_MEDIA="media"
78
 VARIANT_MEDIA="media"
76
 
79
 
77
 SSH_PORT=2222
80
 SSH_PORT=2222
81
+
82
+# kernel specifically tweaked for the Beaglebone Black
78
 KERNEL_VERSION="v3.15.10-bone7"
83
 KERNEL_VERSION="v3.15.10-bone7"
84
+
85
+# Whether or not to use the beaglebone's hardware random number generator
79
 USE_HWRNG="yes"
86
 USE_HWRNG="yes"
87
+
88
+# Whether this system is being installed within a docker container
80
 INSTALLED_WITHIN_DOCKER="no"
89
 INSTALLED_WITHIN_DOCKER="no"
81
 
90
 
82
 # If you want to run an encrypted mailing list specify its name here.
91
 # If you want to run an encrypted mailing list specify its name here.
458
   if grep -Fxq "update_the_kernel" $COMPLETION_FILE; then
467
   if grep -Fxq "update_the_kernel" $COMPLETION_FILE; then
459
       return
468
       return
460
   fi
469
   fi
461
-  if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
470
+  # if this is not a beaglebone or is a docker container
471
+  # then just use the standard kernel
472
+  if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
462
       return
473
       return
463
   fi
474
   fi
464
   cd /opt/scripts/tools
475
   cd /opt/scripts/tools
470
   if grep -Fxq "enable_zram" $COMPLETION_FILE; then
481
   if grep -Fxq "enable_zram" $COMPLETION_FILE; then
471
       return
482
       return
472
   fi
483
   fi
473
-  if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
484
+  if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
474
       return
485
       return
475
   fi
486
   fi
476
   if ! grep -q "options zram num_devices=1" /etc/modprobe.d/zram.conf; then
487
   if ! grep -q "options zram num_devices=1" /etc/modprobe.d/zram.conf; then
552
   if grep -Fxq "random_number_generator" $COMPLETION_FILE; then
563
   if grep -Fxq "random_number_generator" $COMPLETION_FILE; then
553
       return
564
       return
554
   fi
565
   fi
566
+  if [[ $INSTALLING_ON_BBB != "yes" ]]; then
567
+      # On systems which are not beaglebones assume that
568
+      # no hardware random number generator is available
569
+      # and use the second best option
570
+      apt-get -y --force-yes install haveged
571
+      return
572
+  fi
555
   if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
573
   if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
556
       # it is assumed that docker uses the random number
574
       # it is assumed that docker uses the random number
557
       # generator of the host system
575
       # generator of the host system
586
   echo 'configure_ssh' >> $COMPLETION_FILE
604
   echo 'configure_ssh' >> $COMPLETION_FILE
587
   # Don't reboot if installing within docker
605
   # Don't reboot if installing within docker
588
   # random numbers will come from the host system
606
   # random numbers will come from the host system
589
-  if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
607
+  if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
590
       return
608
       return
591
   fi
609
   fi
592
   echo ''
610
   echo ''
2994
 }
3012
 }
2995
 
3013
 
2996
 function decrypt_file {
3014
 function decrypt_file {
2997
-	if [ ! $FILE_TO_DECRYPT ]; then
2998
-		return
2999
-	fi
3000
-	if [ ! -d $FILE_TO_DECRYPT ]; then
3001
-		return
3002
-	fi
3015
+    if [ ! $FILE_TO_DECRYPT ]; then
3016
+        return
3017
+    fi
3018
+    if [ ! -d $FILE_TO_DECRYPT ]; then
3019
+        return
3020
+    fi
3003
     bcrypt $FILE_TO_DECRYPT
3021
     bcrypt $FILE_TO_DECRYPT
3004
 }
3022
 }
3005
 
3023
 
3102
   echo 'echo "Backup completed"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3120
   echo 'echo "Backup completed"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3103
   if [[ $ENCRYPT_BACKUPS == "yes" ]]; then
3121
   if [[ $ENCRYPT_BACKUPS == "yes" ]]; then
3104
       echo 'echo "Archiving backup data"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3122
       echo 'echo "Archiving backup data"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3105
-	  echo "cd $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
3106
-	  echo "tar -czvf $USB_MOUNT/backup.tar.gz $USB_MOUNT/backup" >> /usr/bin/$BACKUP_SCRIPT_NAME
3107
-	  echo 'echo "Encrypting backup data"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3108
-	  echo "bcrypt -c $USB_MOUNT/backup.tar.gz" >> /usr/bin/$BACKUP_SCRIPT_NAME
3123
+      echo "cd $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
3124
+      echo "tar -czvf $USB_MOUNT/backup.tar.gz $USB_MOUNT/backup" >> /usr/bin/$BACKUP_SCRIPT_NAME
3125
+      echo 'echo "Encrypting backup data"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3126
+      echo "bcrypt -c $USB_MOUNT/backup.tar.gz" >> /usr/bin/$BACKUP_SCRIPT_NAME
3109
   fi
3127
   fi
3110
   echo 'exit 0' >> /usr/bin/$RESTORE_SCRIPT_NAME
3128
   echo 'exit 0' >> /usr/bin/$RESTORE_SCRIPT_NAME
3111
   chmod 600 /usr/bin/$BACKUP_SCRIPT_NAME
3129
   chmod 600 /usr/bin/$BACKUP_SCRIPT_NAME