diff options
author | Erik Troan <ewt@redhat.com> | 1997-09-16 14:12:05 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1997-09-16 14:12:05 +0000 |
commit | ced9dffda28f1ec2b060f3e419cf3c6b964b03a1 (patch) | |
tree | da3f56c24861ddc77e2910291c71adc12dca136b /rc.d/init.d/random | |
download | initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.gz initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.bz2 initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.tar.xz initscripts-ced9dffda28f1ec2b060f3e419cf3c6b964b03a1.zip |
Initial revision
Diffstat (limited to 'rc.d/init.d/random')
-rwxr-xr-x | rc.d/init.d/random | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/rc.d/init.d/random b/rc.d/init.d/random new file mode 100755 index 00000000..348f0295 --- /dev/null +++ b/rc.d/init.d/random @@ -0,0 +1,37 @@ +#!/bin/sh +# +# random Script to snapshot random state and reload it at boot time. +# +# Author: Theodore Ts'o <tytso@mit.edu> +# + +random_seed=/var/run/random-seed + +# See how we were called. +case "$1" in + start) + echo "Initializing random number generator..." + # Carry a random seed from start-up to start-up + # Load and then save 512 bytes, which is the size of the entropy pool + if [ -f $random_seed ]; then + cat $random_seed >/dev/urandom + fi + dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null + touch /var/lock/subsys/random + + ;; + stop) + # Carry a random seed from shut-down to start-up + # Save 512 bytes, which is the size of the entropy pool + echo "Saving random seed..." + dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null + + rm -f /var/lock/subsys/random + ;; + *) + echo "Usage: random {start|stop}" + exit 1 +esac + +exit 0 + |