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 # check for read only file system
15 if ! touch /etc
/random-seed
2>/dev
/null
17 echo "read-only file system detected...done"
20 if [ "$VERBOSE" != no
]
22 printf "Initializing random number generator... "
24 # Load and then save 512 bytes,
25 # which is the size of the entropy pool
26 cat /etc
/random-seed
>/dev
/urandom
27 rm -f /etc
/random-seed
29 dd if=/dev
/urandom of
=/etc
/random-seed count
=1 \
30 >/dev
/null
2>&1 ||
echo "urandom start: failed."
32 [ "$VERBOSE" != no
] && echo "done."
35 if ! touch /etc
/random-seed
2>/dev
/null
39 # Carry a random seed from shut-down to start-up;
40 # see documentation in linux/drivers/char/random.c
41 [ "$VERBOSE" != no
] && printf "Saving random seed... "
43 dd if=/dev
/urandom of
=/etc
/random-seed count
=1 \
44 >/dev
/null
2>&1 ||
echo "urandom stop: failed."
45 [ "$VERBOSE" != no
] && echo "done."
48 echo "Usage: urandom {start|stop}" >&2