packages: tzdata/timezone.init - use cksum from coreutils for identical-fil...

glen glen at pld-linux.org
Sun Oct 31 20:28:10 CET 2010


Author: glen                         Date: Sun Oct 31 19:28:10 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use cksum from coreutils for identical-file test

---- Files affected:
packages/tzdata:
   timezone.init (1.17 -> 1.18) 

---- Diffs:

================================================================
Index: packages/tzdata/timezone.init
diff -u packages/tzdata/timezone.init:1.17 packages/tzdata/timezone.init:1.18
--- packages/tzdata/timezone.init:1.17	Fri Oct 29 02:26:45 2010
+++ packages/tzdata/timezone.init	Sun Oct 31 20:28:04 2010
@@ -3,7 +3,6 @@
 # timezone	Set time zone information.
 # chkconfig:	2345 10 90
 # description:	This script is setting time zone information for your machine.
-# Author:	Pawel Wilk <siefca at pld-linux.org>
 #
 # $Id$
 
@@ -54,6 +53,14 @@
 	run_cmd "Unsetting time zone information" rm -f /etc/localtime
 }
 
+# return true if FILE1 and FILE2 are identical
+identical() {
+	local crc1 crc2
+	crc1=$(cksum "$1" | awk '{print $1}')
+	crc2=$(cksum "$2" | awk '{print $1}')
+	[ "$crc1" = "$crc2" ]
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -71,11 +78,9 @@
 	disable
 	;;
   status)
-  	if [ -x /usr/bin/diff ]; then
-  		diff -q "$ZONE_FILE" /etc/localtime >/dev/null 2>&1 && \
-		nls 'Time zone is configured to %s' "$TIMEZONE" || \
+	nls 'Time zone is configured to %s' "$TIMEZONE"
+  	if ! identical "$ZONE_FILE" /etc/localtime; then
 		nls 'Current time zone differs from %s!' "$TIMEZONE"
-	else	nls 'Time zone should be set to %s' "$TIMEZONE"
 	fi
 	;;
   *)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/tzdata/timezone.init?r1=1.17&r2=1.18&f=u



More information about the pld-cvs-commit mailing list