The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / system / skeleton / etc / init.d / S20urandom
1 #! /bin/sh
2 #
3 # urandom       This script saves the random seed between reboots.
4 #               It is called from the boot, halt and reboot scripts.
5 #
6 # Version:      @(#)urandom  1.33  22-Jun-1998  miquels@cistron.nl
7 #
8
9 [ -c /dev/urandom ] || exit 0
10 #. /etc/default/rcS
11
12 case "$1" in
13         start|"")
14                 if [ "$VERBOSE" != no ]
15                 then
16                         echo -n "Initializing random number generator... "
17                 fi
18                 # Load and then save 512 bytes,
19                 # which is the size of the entropy pool
20                 if [ -f /etc/random-seed ]
21                 then
22                         cat /etc/random-seed >/dev/urandom
23                 fi
24                 # check for read only file system
25                 if ! touch /etc/random-seed 2>/dev/null
26                 then
27                         echo "read-only file system detected...done"
28                         exit
29                 fi
30                 rm -f /etc/random-seed
31                 umask 077
32                 dd if=/dev/urandom of=/etc/random-seed count=1 \
33                         >/dev/null 2>&1 || echo "urandom start: failed."
34                 umask 022
35                 [ "$VERBOSE" != no ] && echo "done."
36                 ;;
37         stop)
38                 if ! touch /etc/random-seed 2>/dev/null
39                 then
40                         exit
41                 fi
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... "
45                 umask 077
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."
49                 ;;
50         *)
51                 echo "Usage: urandom {start|stop}" >&2
52                 exit 1
53                 ;;
54 esac