summaryrefslogtreecommitdiff
blob: 0a02dca080dce170c3f62acce5e577a4505c3c6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/rng-tools/files/rngd,v 1.5 2004/07/15 00:50:08 agriffis Exp $

depend() {
	need localmount
	after random
}
 
start() {
	ebegin "Starting hardware RNG daemon"
	if [ -e /dev/hw_random ]; then
		start-stop-daemon --start --quiet --exec /usr/sbin/rngd -- -b -r /dev/hw_random
		eend $? "Failed to start hardware RNG daemon"
	elif [ -e /dev/hwrandom ]; then
		start-stop-daemon --start --quiet --exec /usr/sbin/rngd -- -b -r /dev/hwrandom
		eend $? "Failed to start hardware RNG daemon"
	elif [ -e /dev/i810_rng ]; then
		start-stop-daemon --start --quiet --exec /usr/sbin/rngd -- -b -r /dev/i810_rng
		eend $? "Failed to start hardware RNG daemon"
	else
		einfo "No hardware RNG found, using /dev/urandom as feedback input"
		start-stop-daemon --start --quiet --exec /usr/sbin/rngd -- -b -r /dev/urandom
		eend $? "Failed to start hardware RNG daemon"
	fi
}

stop() {
	ebegin "Stopping hardware RNG daemon"
	start-stop-daemon --stop --quiet --exec /usr/sbin/rngd
	eend $? "Failed to stop hardware RNG daemon"
}