#!/usr/sbin/openrc-run

description="Entropy daemon using the HAVEGE algorithms"

command="/usr/sbin/haveged"
pidfile="/var/run/haveged.pid"

depend() {
	need localmount
	use logger
	after rsyslog
	provide entropy
}

start() {
	[ -x "$command" ] || return 1
	[ -r /etc/default/haveged ] && . /etc/default/haveged

	ebegin "Starting ${RC_SVCNAME}"
	start-stop-daemon -S -p "$pidfile" \
		-x "$command" -- ${DAEMON_ARGS:-}
	eend $?
}

stop() {
	ebegin "Stopping ${RC_SVCNAME}"
	start-stop-daemon -K -p "$pidfile" -R TERM/30/KILL/5
	eend $?
}
