From f04d49d5c5144a2790909b6e668f0c6d6b6a13a7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 27 Jun 2015 10:07:48 +0100 Subject: [PATCH] Check that rng-tools is configured to use the onerng device --- src/freedombone | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/freedombone b/src/freedombone index 64d02d0e..4fd6bc5b 100755 --- a/src/freedombone +++ b/src/freedombone @@ -116,6 +116,9 @@ ONERNG_PACKAGE_DOWNLOAD="https://github.com/OneRNG/onerng.github.io/blob/master/ # Hash for OneRNG driver ONERNG_PACKAGE_HASH='78f1c2f52ae573e3b398a695ece7ab9f41868252657ea269f0d5cf0bd4f2eb59' +# device name for OneRNG +ONERNG_DEVICE='ttyACM0' + # Whether this system is being installed within a docker container INSTALLED_WITHIN_DOCKER="no" @@ -4793,6 +4796,12 @@ function install_onerng { # install the package dpkg -i $ONERNG_PACKAGE + # check rng-tools configuration + if ! grep -q "/dev/$ONERNG_DEVICE" /etc/default/rng-tools; then + echo "HRNGDEVICE=/dev/$ONERNG_DEVICE" >> /etc/default/rng-tools + systemctl restart rng-tools + fi + # Check that the install worked if [ ! -f /etc/onerng.conf ]; then echo 'OneRNG configuration file not found. The package may not have installed successfully.' @@ -8819,7 +8828,7 @@ function create_upgrade_script { echo ' git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo ' cp gpgit.pl /usr/bin' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME - + echo 'exit 0' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME chmod +x /etc/cron.weekly/$UPGRADE_SCRIPT_NAME echo 'create_upgrade_script' >> $COMPLETION_FILE