freebsd-skq/etc/rc.d/preseedrandom
brooks 2368868392 Remove bogus checks on the value of ${entropy_file} and hardcode out
entropy source to /entropy.  We have to assume there is no rc.conf at
this stage of the boot process.

Reported by:	njl
2004-04-15 18:23:14 +00:00

40 lines
806 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: preseedrandom
# KEYWORD: FreeBSD nojail
feed_dev_random()
{
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
fi
}
soft_random_generator=`sysctl kern.random 2>/dev/null`
if [ -n "${soft_random_generator}" ] ; then
echo -n 'Pre-seeding PRNG:'
# XXX temporary until we can improve the entropy
# harvesting rate.
# Entropy below is not great, but better than nothing.
# This unblocks the generator at startup
( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \
| dd of=/dev/random bs=8k 2>/dev/null
cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null
# First pass at reseeding /dev/random.
#
if [ -w /dev/random ]; then
feed_dev_random "/entropy"
fi
echo -n ' kickstart'
echo '.'
fi