]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Time zone information will be updated only when needed.
authorsiefca <siefca@pld-linux.org>
Sat, 4 Mar 2000 22:40:07 +0000 (22:40 +0000)
committersiefca <siefca@pld-linux.org>
Sat, 4 Mar 2000 22:40:07 +0000 (22:40 +0000)
svn-id: @652

rc-scripts.spec.in
rc.d/init.d/timezone
src/Makefile.am
src/resolvesymlink.c [new file with mode: 0644]

index 06a0f0d91edb39ab4c930af1862450995e3be5ad..ac54c056713dcfa6b686b059e70cc095d388b2ca 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: rc-scripts.spec.in,v 1.40 2000/03/04 13:59:16 siefca Exp $
+# $Id: rc-scripts.spec.in,v 1.41 2000/03/04 22:40:06 siefca Exp $
 Summary:       inittab and /etc/rc.d scripts
 Summary(de):   inittab und /etc/rc.d Scripts
 Summary(fr):   inittab et scripts /etc/rc.d
@@ -164,6 +164,7 @@ fi
 %attr(755,root,root) %{_bindir}/doexec
 %attr(755,root,root) %{_bindir}/usleep
 %attr(755,root,root) %{_bindir}/ipcalc
+%attr(755,root,root) %{_bindir}/resolvesymlink
 
 %attr(755,root,root) %{_sbindir}/setsysfont
 %attr(755,root,root) %{_sbindir}/initlog
index 6207a45fb226122c680c5155c2310962b54a8f1a..10d43fd672d7a70e88b311724c7e25f1913c0fe1 100644 (file)
@@ -5,7 +5,7 @@
 # description: This script is setting time zone information for your machine.
 # Author:      Pawel Wilk <siefca@pld.org.pl>
 #
-# $Id: timezone,v 1.2 2000/03/04 13:39:51 siefca Exp $
+# $Id: timezone,v 1.3 2000/03/04 22:40:06 siefca Exp $
 
 # NLS
 NLS_DOMAIN="rc-scripts"
@@ -14,28 +14,26 @@ NLS_DOMAIN="rc-scripts"
 . /etc/rc.d/init.d/functions
 
 [ ! -f /etc/sysconfig/timezone ] && exit 0
-
 . /etc/sysconfig/timezone
 
-# See how we were called.
-case "$1" in
-  start)
-        if [ -f /etc/localtime ]; then
-           rm -f /etc/localtime
-       fi
-       
-       ZONE_FILE="$ZONE_INFO_DIR"
+ZONE_FILE="$ZONE_INFO_DIR"
 
-       if [[ "$ZONE_INFO_SCHEME" != "" ]]; then
-           ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
-       fi
+if [[ "$ZONE_INFO_SCHEME" != "" ]]; then
+    ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
+fi
 
-       if [[ "$ZONE_INFO_AREA" != "" ]]; then
-           ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
-       fi
+if [[ "$ZONE_INFO_AREA" != "" ]]; then
+    ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
+fi
+
+ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
 
-       ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
+[ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" == "$ZONE_FILE" ] && exit 0
 
+# See how we were called.
+case "$1" in
+  start)
+        rm -f /etc/localtime
        if [ -f "$ZONE_FILE" ]; then
                if [[ "$ZONE_INFO_AREA" != "" ]]; then
                    run_cmd "Setting time zone information ($ZONE_INFO_AREA, $TIME_ZONE)" ln -s $ZONE_FILE /etc/localtime
index 410a64f905674a38e0988dea6de030dc24e8b57a..5be648d3c5936ed91529f7df078cf82a439ee100 100644 (file)
@@ -3,7 +3,8 @@
 bin_PROGRAMS = \
        doexec \
        ipcalc \
-       usleep  
+       usleep \
+       resolvesymlink
        
 sbin_PROGRAMS =        \
        netreport \
@@ -19,6 +20,8 @@ EXTRA_PROGRAMS = \
        
 doexec_SOURCES = doexec.c
 
+resolvesymlink_SOURCE = resolvesymlink.c
+
 ipcalc_SOURCES = ipcalc.c
 ipcalc_LDADD = -lpopt
 
diff --git a/src/resolvesymlink.c b/src/resolvesymlink.c
new file mode 100644 (file)
index 0000000..5e07a81
--- /dev/null
@@ -0,0 +1,17 @@
+#include <sys/param.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+int main(int argc, char ** argv) {
+    char *buf = calloc (MAXPATHLEN+1, sizeof(char));
+    
+    if (argc<1) return 1;
+    (void) readlink (argv[1], buf, MAXPATHLEN);
+    fprintf (stdout, "%s", buf);
+    exit (0);
+    }
This page took 0.318846 seconds and 4 git commands to generate.