Browse Source

Check that rng-tools is configured to use the onerng device

Bob Mottram 9 years ago
parent
commit
f04d49d5c5
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      src/freedombone

+ 10
- 1
src/freedombone View File

@@ -116,6 +116,9 @@ ONERNG_PACKAGE_DOWNLOAD="https://github.com/OneRNG/onerng.github.io/blob/master/
116 116
 # Hash for OneRNG driver
117 117
 ONERNG_PACKAGE_HASH='78f1c2f52ae573e3b398a695ece7ab9f41868252657ea269f0d5cf0bd4f2eb59'
118 118
 
119
+# device name for OneRNG
120
+ONERNG_DEVICE='ttyACM0'
121
+
119 122
 # Whether this system is being installed within a docker container
120 123
 INSTALLED_WITHIN_DOCKER="no"
121 124
 
@@ -4793,6 +4796,12 @@ function install_onerng {
4793 4796
   # install the package
4794 4797
   dpkg -i $ONERNG_PACKAGE
4795 4798
 
4799
+  # check rng-tools configuration
4800
+  if ! grep -q "/dev/$ONERNG_DEVICE" /etc/default/rng-tools; then
4801
+      echo "HRNGDEVICE=/dev/$ONERNG_DEVICE" >> /etc/default/rng-tools
4802
+      systemctl restart rng-tools
4803
+  fi
4804
+
4796 4805
   # Check that the install worked
4797 4806
   if [ ! -f /etc/onerng.conf ]; then
4798 4807
       echo 'OneRNG configuration file not found. The package may not have installed successfully.'
@@ -8819,7 +8828,7 @@ function create_upgrade_script {
8819 8828
   echo '    git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
8820 8829
   echo '    cp gpgit.pl /usr/bin' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
8821 8830
   echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
8822
-  
8831
+
8823 8832
   echo 'exit 0' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
8824 8833
   chmod +x /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
8825 8834
   echo 'create_upgrade_script' >> $COMPLETION_FILE