#!/bin/sh
#
# CRYPTORAND  12/19/94  W Soley
#

# Starts cryptorand deamon at system boot time ...
#   /etc/init.d/cryptorand
#   /etc/rc2.d/S50cryptorand

# Expects cryptorand deamon executable in ...
cryptorand=/usr/lib/security/cryptorand

# Creates and services fifo in ...
fifo=/dev/random

if [ -f /dev/cryptorand ] ; then
	rm -f /dev/cryptorand
	echo "$0: Warning - random device name changed from /dev/cryptorand to $fifo"
fi

case "$1" in
'start')
	ps -ef | awk '/usr.lib.security.cryptorand/{print "kill",$2}' | sh
	if [ -f $cryptorand ] ; then
		$cryptorand $fifo
	fi
	;;
'stop')
	ps -ef | awk '/usr.lib.security.cryptorand/{print "kill",$2}' | sh
	rm -f $fifo
	;;
*)
	echo "Usage: /etc/init.d/cryptorand { start | stop }"
	exit 1
	;;
esac
