rngd: update initskript and add hwrngtty support
[ipfire-2.x.git] / src / initscripts / system / rngd
CommitLineData
8af8d5d1
MT
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
14case "${1}" in
15 start)
56726ed9
AF
16 if pidofproc -s /usr/sbin/rngd; then
17 boot_mesg "Random Number Generator Daemon is already running..."
18 echo_ok;
19 exit 0
20 fi
21 if [ -e /dev/hwrngtty ]; then
22 HWRNG=/dev/hwrngtty
23 else
24 HWRNG=/dev/hwrng
25 fi
8af8d5d1 26 boot_mesg "Starting Random Number Generator Daemon..."
56726ed9 27 loadproc /usr/sbin/rngd -r $HWRNG --quiet
8af8d5d1
MT
28 ;;
29
30 stop)
31 boot_mesg "Stopping Random Number Generator Daemon..."
bc70c827 32 killproc -p /var/run/rngd.pid /usr/sbin/rngd
8af8d5d1
MT
33 ;;
34
35 restart)
36 ${0} stop
37 sleep 1
38 ${0} start
39 ;;
40
41 status)
42 statusproc /usr/sbin/rngd
43 ;;
44
2af81793
MT
45 udev-event)
46 $0 restart &>/dev/null
47 ;;
48
8af8d5d1
MT
49 *)
50 echo "Usage: ${0} {start|stop|restart|status}"
51 exit 1
52 ;;
53esac
54
55# End $rc_base/init.d/rngd