39d3f406ce
makes any sense. Discussed with: dougb, brooks MFC after: 3 days
40 lines
798 B
Bash
40 lines
798 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: preseedrandom
|
|
# KEYWORD: 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
|