Browse Source

Option to install on systems other than the Beaglebone Black

Bob Mottram 10 years ago
parent
commit
b60210b966
1 changed files with 31 additions and 13 deletions
  1. 31
    13
      install-freedombone.sh

+ 31
- 13
install-freedombone.sh View File

@@ -64,6 +64,9 @@ MY_USERNAME=$2
64 64
 FREEDNS_SUBDOMAIN_CODE=$3
65 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 70
 # Different system variants which may be specified within
68 71
 # the SYSTEM_TYPE option
69 72
 VARIANT_WRITER="writer"
@@ -75,8 +78,14 @@ VARIANT_SOCIAL="social"
75 78
 VARIANT_MEDIA="media"
76 79
 
77 80
 SSH_PORT=2222
81
+
82
+# kernel specifically tweaked for the Beaglebone Black
78 83
 KERNEL_VERSION="v3.15.10-bone7"
84
+
85
+# Whether or not to use the beaglebone's hardware random number generator
79 86
 USE_HWRNG="yes"
87
+
88
+# Whether this system is being installed within a docker container
80 89
 INSTALLED_WITHIN_DOCKER="no"
81 90
 
82 91
 # If you want to run an encrypted mailing list specify its name here.
@@ -458,7 +467,9 @@ function update_the_kernel {
458 467
   if grep -Fxq "update_the_kernel" $COMPLETION_FILE; then
459 468
       return
460 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 473
       return
463 474
   fi
464 475
   cd /opt/scripts/tools
@@ -470,7 +481,7 @@ function enable_zram {
470 481
   if grep -Fxq "enable_zram" $COMPLETION_FILE; then
471 482
       return
472 483
   fi
473
-  if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
484
+  if [[ $INSTALLED_WITHIN_DOCKER == "yes" || $INSTALLING_ON_BBB != "yes" ]]; then
474 485
       return
475 486
   fi
476 487
   if ! grep -q "options zram num_devices=1" /etc/modprobe.d/zram.conf; then
@@ -552,6 +563,13 @@ function random_number_generator {
552 563
   if grep -Fxq "random_number_generator" $COMPLETION_FILE; then
553 564
       return
554 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 573
   if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
556 574
       # it is assumed that docker uses the random number
557 575
       # generator of the host system
@@ -586,7 +604,7 @@ function configure_ssh {
586 604
   echo 'configure_ssh' >> $COMPLETION_FILE
587 605
   # Don't reboot if installing within docker
588 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 608
       return
591 609
   fi
592 610
   echo ''
@@ -2994,12 +3012,12 @@ function install_mediagoblin {
2994 3012
 }
2995 3013
 
2996 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 3021
     bcrypt $FILE_TO_DECRYPT
3004 3022
 }
3005 3023
 
@@ -3102,10 +3120,10 @@ function create_backup_script {
3102 3120
   echo 'echo "Backup completed"' >> /usr/bin/$BACKUP_SCRIPT_NAME
3103 3121
   if [[ $ENCRYPT_BACKUPS == "yes" ]]; then
3104 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 3127
   fi
3110 3128
   echo 'exit 0' >> /usr/bin/$RESTORE_SCRIPT_NAME
3111 3129
   chmod 600 /usr/bin/$BACKUP_SCRIPT_NAME