openssl/openssh updates from below0
[openwrt.git] / obsolete-buildroot / sources / target_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 rm -f /etc/random-seed
25 umask 077
26 dd if=/dev/urandom of=/etc/random-seed count=1 \
27 >/dev/null 2>&1 || echo "urandom start: failed."
28 umask 022
29 [ "$VERBOSE" != no ] && echo "done."
30 ;;
31 stop)
32 # Carry a random seed from shut-down to start-up;
33 # see documentation in linux/drivers/char/random.c
34 [ "$VERBOSE" != no ] && echo -n "Saving random seed... "
35 umask 077
36 dd if=/dev/urandom of=/etc/random-seed count=1 \
37 >/dev/null 2>&1 || echo "urandom stop: failed."
38 [ "$VERBOSE" != no ] && echo "done."
39 ;;
40 *)
41 echo "Usage: urandom {start|stop}" >&2
42 exit 1
43 ;;
44 esac
This page took 0.045194 seconds and 5 git commands to generate.