[Pkg-sysvinit-commits] r134 - sysvinit/trunk/debian/initscripts/etc/init.d

Thomas Hood jdthood-guest at costa.debian.org
Fri Nov 18 13:55:59 UTC 2005


Author: jdthood-guest
Date: 2005-11-18 13:55:58 +0000 (Fri, 18 Nov 2005)
New Revision: 134

Modified:
   sysvinit/trunk/debian/initscripts/etc/init.d/urandom
Log:
Use log_action_begin_msg and log_action_end_msg instead of log_begin_msg and log_end_msg; exit 3 on bad argument a la LSB; add quotation marks around variable refs

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/urandom
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/urandom	2005-11-18 13:51:23 UTC (rev 133)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/urandom	2005-11-18 13:55:58 UTC (rev 134)
@@ -29,46 +29,44 @@
 
 case "$1" in
 	start|"")
-		[ "$VERBOSE" != no ] && log_begin_msg "Initializing random number generator..."
+		[ "$VERBOSE" != no ] && log_action_begin_msg "Initializing random number generator"
 
 		# Load and then save $POOLSIZE bytes,
 		# which is the size of the entropy pool
-		if [ -f $SAVEDFILE ]
+		if [ -f "$SAVEDFILE" ]
 		then
 			# Handle locally increased pool size
 			SAVEDSIZE=`find $SAVEDFILE -printf "%s"`
-			if [ $SAVEDSIZE -gt $POOLSIZE ]
+			if [ "$SAVEDSIZE" -gt "$POOLSIZE" ]
 			then
 				[ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize
 				POOLSIZE=$SAVEDSIZE
 			fi
-			cat $SAVEDFILE >/dev/urandom
+			cat "$SAVEDFILE" >/dev/urandom
 		fi
 		rm -f $SAVEDFILE
 		umask 077
-		dd if=/dev/urandom of=$SAVEDFILE \
-			bs=$POOLSIZE count=1 >/dev/null 2>&1
+		dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
 		ES=$?
 		umask 022
-		[ "$VERBOSE" != no ] && log_end_msg $ES
+		[ "$VERBOSE" != no ] && log_action_end_msg $ES
 		;;
 	stop)
 		# Carry a random seed from shut-down to start-up;
 		# see documentation in linux/drivers/char/random.c
-		[ "$VERBOSE" != no ] && log_begin_msg "Saving random seed..."
+		[ "$VERBOSE" != no ] && log_action_begin_msg "Saving random seed"
 		umask 077
-		dd if=/dev/urandom of=$SAVEDFILE \
-			bs=$POOLSIZE count=1 >/dev/null 2>&1
+		dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
 		ES=$?
-		[ "$VERBOSE" != no ] && log_end_msg $ES
+		[ "$VERBOSE" != no ] && log_action_end_msg $ES
 		;;
         restart|reload|force-reload)
-        	echo "error: '$0 $1' not supported"
-		exit 1
+        	echo "Error: argument '$1' not supported" >&2
+		exit 3
 		;;
 	*)
 		echo "Usage: urandom {start|stop}" >&2
-		exit 1
+		exit 3
 		;;
 esac
 




More information about the Pkg-sysvinit-commits mailing list