]> 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 df4aa7da2f26d3b5b922ba6590867ceaf28ef82f..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
-
-               boot_mesg "Starting Random Number Generator Daemon..."
-
-               if pidofproc /usr/sbin/rngd &>/dev/null; then
-                       # Is already running.
-                       echo_ok
+               if [ -e /dev/hwrngtty ]; then
+                       HWRNG=/dev/hwrngtty
                else
-                       loadproc /usr/sbin/rngd --no-tpm=1
+                       HWRNG=/dev/hwrng
                fi
+               boot_mesg "Starting Random Number Generator Daemon..."
+               loadproc /usr/sbin/rngd -r $HWRNG --quiet
                ;;
 
        stop)