android-raptor – Blame information for rev 2

Subversion Repositories:
Rev:
Rev Author Line No. Line
2 office 1 #!/bin/sh
1 office 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 # 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
19 fi
20 if [ "$VERBOSE" != no ]
21 then
22 printf "Initializing random number generator... "
23 fi
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."
33 ;;
34 stop)
35 if ! touch /etc/random-seed 2>/dev/null
36 then
37 exit
38 fi
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."
46 ;;
47 *)
48 echo "Usage: urandom {start|stop}" >&2
49 exit 1
50 ;;
51 esac