]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/rngd
Merge remote-tracking branch 'stevee/squid-zph-qos' into beyond-next
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / rngd
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/rngd
4 #
5 # Description : Random Number Generator Daemon
6 #
7 # Authors : Michael Tremer <michael.tremer@ipfire.org>
8 #
9 ########################################################################
10
11 . /etc/sysconfig/rc
12 . ${rc_functions}
13
14 function has_rdrand() {
15 grep -q "rdrand" /proc/cpuinfo
16 }
17
18 function has_hwrng() {
19 [ -e "/dev/hwrng" ]
20 }
21
22 case "${1}" in
23 start)
24 if ! has_hwrng && ! has_rdrand; then
25 boot_mesg "No Hardware Random Number Generator found..."
26 echo_warning
27 exit 0
28 fi
29
30 boot_mesg "Starting Random Number Generator Daemon..."
31 loadproc /usr/sbin/rngd --no-tpm=1
32 ;;
33
34 stop)
35 boot_mesg "Stopping Random Number Generator Daemon..."
36 killproc /usr/sbin/rngd
37 ;;
38
39 restart)
40 ${0} stop
41 sleep 1
42 ${0} start
43 ;;
44
45 status)
46 statusproc /usr/sbin/rngd
47 ;;
48
49 udev-event)
50 $0 restart &>/dev/null
51 ;;
52
53 *)
54 echo "Usage: ${0} {start|stop|restart|status}"
55 exit 1
56 ;;
57 esac
58
59 # End $rc_base/init.d/rngd