Update to new upstream release (v0.8.0).
authorNicolas Thill <nico@openwrt.org>
Thu, 2 Jun 2005 02:04:01 +0000 (02:04 +0000)
committerNicolas Thill <nico@openwrt.org>
Thu, 2 Jun 2005 02:04:01 +0000 (02:04 +0000)
Change the patch that disabled server response checking.
Enable initscript at startup with prio. 49.
Change initscript to set the time first and then daemonize.

SVN-Revision: 1137

openwrt/package/htpdate/Makefile
openwrt/package/htpdate/files/htpdate.default
openwrt/package/htpdate/files/htpdate.init
openwrt/package/htpdate/patches/500-check-time-delta-opt.patch [new file with mode: 0644]
openwrt/package/htpdate/patches/no-time-delta-check.patch [deleted file]

index eb588c5c6176201ac4f8edd5724dcfd978117708..8505425747eff3fc7c3b55011a341d309167e344 100644 (file)
@@ -3,9 +3,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=htpdate
-PKG_VERSION:=0.7.2
+PKG_VERSION:=0.8.0
 PKG_RELEASE:=1
-PKG_MD5SUM:=5b5ab483bdb3ebe155c72197e1b885f6
+PKG_MD5SUM:=5fd1ba822e0949a3cb34e3f61fbeb8ca
 
 PKG_SOURCE_URL:=http://www.clevervest.com/htp/archive/c/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -32,8 +32,9 @@ $(IPKG_HTPDATE):
        install -m0644 ./files/htpdate.default $(IDIR_HTPDATE)/etc/default/htpdate
        install -d -m0755 $(IDIR_HTPDATE)/etc/init.d/
        install -m0755 ./files/htpdate.init $(IDIR_HTPDATE)/etc/init.d/htpdate
+       ln -sf htpdate $(IDIR_HTPDATE)/etc/init.d/S49htpdate
        install -d -m0755 $(IDIR_HTPDATE)/usr/sbin
-       cp -fpR $(PKG_BUILD_DIR)/htpdate $(IDIR_HTPDATE)/usr/sbin/
+       install -m0755 $(PKG_BUILD_DIR)/htpdate $(IDIR_HTPDATE)/usr/sbin/
        $(RSTRIP) $(IDIR_HTPDATE)
        $(IPKG_BUILD) $(IDIR_HTPDATE) $(PACKAGE_DIR)
 
index 8c182b3ee153999cfc875b63bf17a7dd8f0a337f..94674fdd3c6716d8ae8fcf1d0f342a02002468c1 100644 (file)
@@ -1 +1 @@
-OPTIONS="-D www.google.com www.yahoo.com www.linux.org www.freebsd.org"
+OPTIONS="www.google.com www.yahoo.com www.linux.org www.freebsd.org"
index 9af0e5595305396736db08f7e6833bb6055cfd7a..69d3d35f577f8890c6a1ceab96a6f7bbed31cc12 100644 (file)
@@ -9,7 +9,7 @@ PID_F=$RUN_D/$BIN.pid
 case $1 in
  start)
   mkdir -p $RUN_D
-  $BIN $OPTIONS
+  $BIN -C 0 -l -s $OPTIONS && $BIN -D $OPTIONS
   ;;
  stop)
   [ -f $PID_F ] && kill $(cat $PID_F)
diff --git a/openwrt/package/htpdate/patches/500-check-time-delta-opt.patch b/openwrt/package/htpdate/patches/500-check-time-delta-opt.patch
new file mode 100644 (file)
index 0000000..d5e663f
--- /dev/null
@@ -0,0 +1,67 @@
+diff -ruN htpdate-0.8.0-old/htpdate.c htpdate-0.8.0-new/htpdate.c
+--- htpdate-0.8.0-old/htpdate.c        2005-05-26 23:32:18.000000000 +0200
++++ htpdate-0.8.0-new/htpdate.c        2005-06-02 04:33:33.000000000 +0200
+@@ -243,7 +243,7 @@
+       printf("htpdate version %s\n", version);
+       printf("\
+ Usage: htpdate [-0|-1] [-a|-q|-s] [-d|-D] [-h|-l] [-i pid file] [-m minpoll]\n\
+-        [-M maxpoll] [-P <proxyserver>[:port]] <host[:port]> ...\n\n\
++        [-M maxpoll] [-C limit] [-P <proxyserver>[:port]] <host[:port]> ...\n\n\
+   -0    HTTP/1.0 request (default)\n\
+   -1    HTTP/1.1 request\n\
+   -a    adjust time smoothly\n\
+@@ -257,6 +257,8 @@
+   -m    minimum poll interval (2^m)\n\
+   -M    maximum poll interval (2^M)\n\
+   -P    proxy server\n\
++  -C    time delta limit in server responses (in seconds)\n\
++          default: 1 year, unlimited: 0\n\
+   host  web server hostname or ip address\n\
+   port  port number (default 80 and 8080 for proxy server)\n\n");
+@@ -271,6 +273,7 @@
+       int                                     port, proxyport = 8080;
+       int                                     sumtime, numservers, validtime, goodtime, mean, i;
+       double                          timeavg;
++      int                                     timedeltalimit = YEAR;
+       unsigned int            nap = 0, when = 500000;
+       unsigned int            minsleep = 10, maxsleep = 18, sleeptime = minsleep;
+       char                            setmode = 0, httpversion = 0, try, param;
+@@ -283,7 +286,7 @@
+       /* Parse the command line switches and arguments */
+-      while ( (param = getopt(argc, argv, "01adhi:lm:qsDM:P:") ) != -1)
++      while ( (param = getopt(argc, argv, "01adhi:lm:qsDM:P:C:") ) != -1)
+       switch (param)
+       {
+               case '0':                       /* adjust time */
+@@ -340,6 +343,12 @@
+                               }
+                       }
+                       break;
++              case 'C':                       /* time delta limit in server responses */
++                      if ( (timedeltalimit = atoi(optarg) ) < 0 ) {
++                              printlog( 1, "Invalid time delta limit" );
++                              exit(1);
++                      }
++                      break;
+               case '?':
+                       return 1;
+               default:
+@@ -458,10 +467,12 @@
+                       try--;
+               } while ( timestamp && try && daemonize );
+-              /* Only include valid responses in timedelta[], |delta time| < year */
+-              if ( ( timestamp > -YEAR ) && ( timestamp < YEAR ) ) {
+-                      timedelta[validtime] = timestamp;
++              timedelta[validtime] = timestamp;
++              /* Only include valid responses in timedelta[], |delta time| < validlimit */
++              if ( ( timedeltalimit == 0 ) || ( ( timestamp > -timedeltalimit ) && ( timestamp < timedeltalimit ) ) ) {
+                       validtime++;
++              } else {
++                      printlog( 0, "Invalid server response (host: %s, time delta: %d, limit: %d)", host, timestamp, timedeltalimit);
+               }
+               /* Sleep for a while, unless we detected a time offset */
diff --git a/openwrt/package/htpdate/patches/no-time-delta-check.patch b/openwrt/package/htpdate/patches/no-time-delta-check.patch
deleted file mode 100644 (file)
index f459295..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- htpdate-0.7.2-orig/htpdate.c       2005-05-05 20:53:13.000000000 +0200
-+++ htpdate-0.7.2-1/htpdate.c  2005-05-07 15:31:21.000000000 +0200
-@@ -411,11 +411,8 @@
-               timestamp = getHTTPdate( host, port, proxy, proxyport, when );
--              /* Only include valid responses in timedelta[], |delta time| < year */
--              if ( labs(timestamp) < 31536000 ) {
-                       timedelta[validtime] = timestamp;
-                       validtime++;
--              }
-               /* Sleep for a while, unless we detect a time offset */
-               if ( daemonize && (timestamp == 0) )