SVN: rc-scripts/trunk/rc.d/init.d/random
glen
glen at pld-linux.org
Fri Nov 9 01:21:43 CET 2007
Author: glen
Date: Fri Nov 9 01:21:42 2007
New Revision: 9020
Modified:
rc-scripts/trunk/rc.d/init.d/random
Log:
- use subsys lock files
Modified: rc-scripts/trunk/rc.d/init.d/random
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/random (original)
+++ rc-scripts/trunk/rc.d/init.d/random Fri Nov 9 01:21:42 2007
@@ -17,33 +17,38 @@
# See how we were called.
case "$1" in
start)
- show "Initializing random number generator"
- busy
- # 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
- else
- touch $random_seed
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/random ]; then
+ show "Initializing random number generator"
+ busy
+ # 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
+ else
+ touch $random_seed
+ fi
+ chmod 600 $random_seed
+ dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
+ touch /var/lock/subsys/random
+ deltext
+ ok
fi
- chmod 600 $random_seed
- dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
- touch /var/lock/subsys/random
- deltext
- ok
;;
stop)
- # Carry a random seed from shut-down to start-up
- # Save 512 bytes, which is the size of the entropy pool
- show "Saving random seed"
- busy
- touch $random_seed
- chmod 600 $random_seed
- dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
+ if [ -f /var/lock/subsys/random ]; then
+ # Carry a random seed from shut-down to start-up
+ # Save 512 bytes, which is the size of the entropy pool
+ show "Saving random seed"
+ busy
+ touch $random_seed
+ chmod 600 $random_seed
+ dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
- rm -f /var/lock/subsys/random
- deltext
- ok
+ rm -f /var/lock/subsys/random
+ deltext
+ ok
+ fi
;;
status)
# this is way overkill, but at least we have some status output...
@@ -53,13 +58,7 @@
nls "The random data source is missing"
fi
;;
- restart|reload)
- # do not do anything; this is unreasonable
- :
- ;;
*)
- # do not advertise unreasonable commands that there is no reason
- # to use with this device
msg_usage "$0 {start|stop|status}"
exit 3
esac
More information about the pld-cvs-commit
mailing list