[arch-general] [PATCH 23/48] Clean up entropy pool saving and system clock saving.

Victor Lowther victor.lowther at gmail.com
Wed Jun 30 17:47:44 EDT 2010


---
 rc.shutdown |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/rc.shutdown b/rc.shutdown
index cc39030..b2278b6 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -27,8 +27,8 @@ RANDOM_SEED=/var/lib/misc/random-seed
 : > $RANDOM_SEED
 /bin/chmod 0600 $RANDOM_SEED
 POOL_FILE=/proc/sys/kernel/random/poolsize
-if [ -r $POOL_FILE ]; then
-	POOL_SIZE=$(/bin/cat $POOL_FILE)
+if [[ -r $POOL_FILE ]]; then
+	read POOL_SIZE <$POOL_FILE
 else
 	POOL_SIZE=512
 fi
@@ -36,22 +36,18 @@ fi
 stat_done
 
 stat_busy "Saving System Clock"
-if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
+if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
 	/bin/rm -f /etc/localtime
 	/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
 fi
 
 HWCLOCK_PARAMS="--systohc"
-if [ "$HARDWARECLOCK" = "UTC" ]; then
-	HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
-elif [ "$HARDWARECLOCK" = "localtime" ]; then
-	HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
-else
-	HWCLOCK_PARAMS=""
-fi
-if [ -n "$HWCLOCK_PARAMS" ]; then
-	/sbin/hwclock $HWCLOCK_PARAMS
-fi
+case $HARDWARECLOCK in 
+    UTC) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc";;
+    localtime) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime";;
+    *) HWCLOCK_PARAMS="";;
+esac
+[[ $HWCLOCK_PARAMS ]] && /sbin/hwclock $HWCLOCK_PARAMS
 stat_done
 
 # removing psmouse module to fix some reboot issues on newer laptops
-- 
1.7.1



More information about the arch-general mailing list