3 # urandom This script saves the random seed between reboots.
4 # It is called from the boot, halt and reboot scripts.
6 # Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl
9 [ -c /dev/urandom ] || exit 0
14 if [ "$VERBOSE" != no ]
16 echo -n "Initializing random number generator... "
18 # Load and then save 512 bytes,
19 # which is the size of the entropy pool
20 if [ -f /etc/random-seed ]
22 cat /etc/random-seed >/dev/urandom
24 # check for read only file system
25 if ! touch /etc/random-seed 2>/dev/null
27 echo "read-only file system detected...done"
30 rm -f /etc/random-seed
32 dd if=/dev/urandom of=/etc/random-seed count=1 \
33 >/dev/null 2>&1 || echo "urandom start: failed."
35 [ "$VERBOSE" != no ] && echo "done."
38 if ! touch /etc/random-seed 2>/dev/null
42 # Carry a random seed from shut-down to start-up;
43 # see documentation in linux/drivers/char/random.c
44 [ "$VERBOSE" != no ] && echo -n "Saving random seed... "
46 dd if=/dev/urandom of=/etc/random-seed count=1 \
47 >/dev/null 2>&1 || echo "urandom stop: failed."
48 [ "$VERBOSE" != no ] && echo "done."
51 echo "Usage: urandom {start|stop}" >&2