Author: glen
Date: Sun Sep 17 21:05:59 2006
New Revision: 7785

Modified:
   rc-scripts/trunk/rc.d/init.d/timezone
Log:
Use lockfiles.

Modified: rc-scripts/trunk/rc.d/init.d/timezone
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/timezone       (original)
+++ rc-scripts/trunk/rc.d/init.d/timezone       Sun Sep 17 21:05:59 2006
@@ -28,21 +28,27 @@
 [ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" = "$ZONE_FILE" ] && 
exit 0
 
 start() {
-       rm -f /etc/localtime
-       if [ -f "$ZONE_FILE" ]; then
-               if [ -n "$ZONE_INFO_AREA" ]; then
-                       MESSAGE="`nls 'Setting time zone information (%s, %s)' 
"$ZONE_INFO_AREA" "$TIME_ZONE"`"
-               else
-                       MESSAGE="`nls 'Setting time zone information (%s)' 
"$TIME_ZONE"`"
+       if [ ! -f /var/lock/subsys/timezone ]; then
+               rm -f /etc/localtime
+               if [ -f "$ZONE_FILE" ]; then
+                       if [ -n "$ZONE_INFO_AREA" ]; then
+                               MESSAGE="`nls 'Setting time zone information 
(%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
+                       else
+                               MESSAGE="`nls 'Setting time zone information 
(%s)' "$TIME_ZONE"`"
+                       fi
+                       run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
+                       RETVAL=$?
                fi
-               run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
-               RETVAL=$?
+
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/timezone
        fi
 }
 
 stop() {
-       run_cmd "Unsetting time zone information" rm -f /etc/localtime
-       RETVAL=$?
+       if [ -f /var/lock/subsys/timezone ]; then
+               run_cmd "Unsetting time zone information" rm -f /etc/localtime
+               rm -f /var/lock/subsys/timezone
+       fi
 }
 
 RETVAL=0
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to