summaryrefslogtreecommitdiff
blob: 54debbfbccf63a12b0b989c29228101bbfb4ea98 (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
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/rng-tools/files/rngd-initd-4.1,v 1.4 2012/12/17 11:19:35 flameeyes Exp $

depend() {
	need localmount
	after random
	provide entropy
}

# Do NOT add /dev/tpm to this.
DEFAULT_DEVICE="/dev/hw_random* /dev/hwrandom* /dev/i810_rng /dev/hwrng*"
[ $DO_NOT_REMIX_URANDOM -eq 0 ] && DEFAULT_DEVICE="${DEFAULT_DEVICE} /dev/urandom"

find_device() {
	local d
	# The echo is to cause globbing
	for d in $(echo ${DEFAULT_DEVICE}) ; do
		[ -e "${d}" ] && echo "${d}"
	done
}

RNG_DEVICE="${DEVICE:-$(find_device)}"

command=/usr/sbin/rngd
pidfile="/var/run/${SVCNAME}.pid"
command_args="--pid-file ${pidfile} --background --random-step ${STEP:-64} ${NO_TPM:+--no-tmp=1} ${NO_DRNG:+--no-drng=1} --fill-watermark ${WATERMARK} ${RNG_DEVICE:+--rng-device ${RNG_DEVICE}}"
start_stop_daemon_args="--wait 1000"
retry="SIGKILL/5000"