rngd: update initskript and add hwrngtty support
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 6 Dec 2018 21:33:05 +0000 (22:33 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 6 Dec 2018 21:33:05 +0000 (22:33 +0100)
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/rootfiles/core/126/filelists/files
config/udev/90-hwrng.rules
src/initscripts/system/rngd

index ce4e517..90534d7 100644 (file)
@@ -1,4 +1,6 @@
 etc/system-release
 etc/issue
+etc/rc.d/init.d/rngd
+lib/udev/rules.d/90-hwrng.rules
 srv/web/ipfire/cgi-bin/credits.cgi
 var/ipfire/langs
index a939790..cbc555c 100644 (file)
@@ -1 +1,16 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM!="tty", GOTO="ipfire_hwrng_end"
+KERNEL!="ttyACM[0-9]*", GOTO="ipfire_hwrng_end"
+
+SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}"
+
+IMPORT{builtin}="usb_id"
+ENV{ID_SERIAL}=="", GOTO="ipfire_hwrng_end"
+SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}"
+ENV{ID_USB_INTERFACE_NUM}=="", GOTO="ipfire_hwrng_end"
+
+ATTRS{manufacturer}=="IPFire.org", ATTRS{product}=="Random Number Generator*", ENV{.ID_PORT}=="", SYMLINK+="hwrngtty" RUN+="/bin/stty raw -echo -ixoff -F /dev/hwrngtty 115200" RUN+="/etc/rc.d/init.d/rngd udev-event"
+
+LABEL="ipfire_hwrng_end"
 ACTION=="add|remove", KERNEL=="hw_random", RUN+="/etc/rc.d/init.d/rngd udev-event"
index 91b70a7..0f95fde 100644 (file)
 
 case "${1}" in
        start)
+               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)