]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/initscripts/system/rngd
rngd: update initskript and add hwrngtty support
[ipfire-2.x.git] / src / initscripts / system / rngd
index e9a2db40ad588a679576d8bedb252af2960ccc89..0f95fde80ad34f918055d9303e3f94c423bd843b 100644 (file)
 . /etc/sysconfig/rc
 . ${rc_functions}
 
-function has_rdrand() {
-       grep -q "rdrand" /proc/cpuinfo
-}
-
-function has_hwrng() {
-       [ -e "/dev/hwrng" ]
-}
-
 case "${1}" in
        start)
-               if ! has_hwrng && ! has_rdrand; then
-                       boot_mesg "No Hardware Random Number Generator found..."
-                       echo_warning
+               if pidofproc -s /usr/sbin/rngd; then
+                       boot_mesg "Random Number Generator Daemon is already running..."
+                       echo_ok;
                        exit 0
                fi
-
+               if [ -e /dev/hwrngtty ]; then
+                       HWRNG=/dev/hwrngtty
+               else
+                       HWRNG=/dev/hwrng
+               fi
                boot_mesg "Starting Random Number Generator Daemon..."
-               loadproc /usr/sbin/rngd --quiet
+               loadproc /usr/sbin/rngd -r $HWRNG --quiet
                ;;
 
        stop)