diff options
Diffstat (limited to 'package/rng-tools/files')
-rw-r--r-- | package/rng-tools/files/rng-tools.postinst | 2 | ||||
-rw-r--r-- | package/rng-tools/files/rngd.init | 40 |
2 files changed, 42 insertions, 0 deletions
diff --git a/package/rng-tools/files/rng-tools.postinst b/package/rng-tools/files/rng-tools.postinst new file mode 100644 index 000000000..4e769fe4b --- /dev/null +++ b/package/rng-tools/files/rng-tools.postinst @@ -0,0 +1,2 @@ +. $IPKG_INSTROOT/etc/functions.sh +add_rcconf rngd rngd NO diff --git a/package/rng-tools/files/rngd.init b/package/rng-tools/files/rngd.init new file mode 100644 index 000000000..1464209c0 --- /dev/null +++ b/package/rng-tools/files/rngd.init @@ -0,0 +1,40 @@ +#!/bin/sh +#PKG rng-tools +#INIT 60 + +. /etc/rc.conf + +case $1 in +autostop) ;; +autostart) + test x"${rngd:-NO}" = x"NO" && exit 0 + exec sh $0 start + ;; +start) + devnode="" + for node in hw_random hwrandom i810_rng hwrng; do + if [ -e /dev/$node ]; then + devnode=/dev/$node + break + fi + done + if [ -z "$devnode" ]; then + echo "no hardware RNG found, falling back to /dev/urandom" + devnode=/dev/urandom + fi + rngd -b -r $devnode + ;; +stop) + pkill rngd + ;; +restart) + sh $0 stop + sleep 1 + sh $0 start + ;; +*) + echo "Usage: $0 {start | stop | restart}" + exit 1 + ;; +esac +exit $? |