python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / initscripts / init.d / S20urandom
blob2f5b4e4c861dd6bc109069f307ad94b60f392c49
1 #! /bin/sh
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
10 #. /etc/default/rcS
12 case "$1" in
13 start|"")
14 # check for read only file system
15 if ! touch /etc/random-seed 2>/dev/null
16 then
17 echo "read-only file system detected...done"
18 exit
20 if [ "$VERBOSE" != no ]
21 then
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
28 umask 077
29 dd if=/dev/urandom of=/etc/random-seed count=1 \
30 >/dev/null 2>&1 || echo "urandom start: failed."
31 umask 022
32 [ "$VERBOSE" != no ] && echo "done."
34 stop)
35 if ! touch /etc/random-seed 2>/dev/null
36 then
37 exit
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... "
42 umask 077
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
49 exit 1
51 esac