Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / random
1 #!/bin/sh
2 # Begin $rc_base/init.d/random
3
4 # Based on sysklogd script from LFS-3.1 and earlier.
5 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
6 # Random script elements by Larry Lawrence
7
8 . /etc/sysconfig/rc
9 . $rc_functions
10
11 case "$1" in
12 start)
13 boot_mesg "Initializing kernel random number generator..."
14 if [ -f /var/tmp/random-seed ]; then
15 /bin/cat /var/tmp/random-seed >/dev/urandom
16 fi
17 /bin/dd if=/dev/urandom of=/var/tmp/random-seed \
18 count=4 &>/dev/null
19 evaluate_retval
20 ;;
21
22 stop)
23 boot_mesg "Saving random seed..."
24 /bin/dd if=/dev/urandom of=/var/tmp/random-seed \
25 count=4 &>/dev/null
26 evaluate_retval
27 ;;
28
29 *)
30 echo "Usage: $0 {start|stop}"
31 exit 1
32 ;;
33 esac
34
35 # End $rc_base/init.d/random