ntp: update to 4.2.6p3
authorKoen Kooi <koen@openembedded.org>
Thu, 6 Jan 2011 17:39:59 +0000 (18:39 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Thu, 11 Oct 2012 21:28:51 +0000 (00:28 +0300)
Signed-off-by: Koen Kooi <koen@openembedded.org>
recipes/ntp/ntp-4.2.6p3/ntpdate [new file with mode: 0755]
recipes/ntp/ntp-4.2.6p3/tickadj.c.patch [new file with mode: 0644]
recipes/ntp/ntp_4.2.6p3.bb [new file with mode: 0644]

diff --git a/recipes/ntp/ntp-4.2.6p3/ntpdate b/recipes/ntp/ntp-4.2.6p3/ntpdate
new file mode 100755 (executable)
index 0000000..784b029
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/bin
+
+test -x /usr/bin/ntpdate || exit 0
+
+if test -f /etc/default/ntpdate ; then
+. /etc/default/ntpdate
+else
+NTPSERVERS="pool.ntp.org"
+fi
+
+test -n "$NTPSERVERS" || exit 0
+
+# This is a heuristic:  The idea is that if a static interface is brought
+# up, that is a major event, and we can put in some extra effort to fix
+# the system time.  Feel free to change this, especially if you regularly
+# bring up new network interfaces.
+if [ "$METHOD" = static ]; then
+       OPTS="-b"
+fi
+
+if [ "$METHOD" = loopback ]; then
+       exit 0
+fi
+
+(
+
+LOCKFILE=/var/lock/ntpdate
+
+# Avoid running more than one at a time
+if [ -x /usr/bin/lockfile-create ]; then
+       lockfile-create $LOCKFILE
+       lockfile-touch $LOCKFILE &
+       LOCKTOUCHPID="$!"
+fi
+
+if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then
+       if [ "$UPDATE_HWCLOCK" = "yes" ]; then
+               hwclock --systohc || :
+       fi
+fi
+
+if [ -x /usr/bin/lockfile-create ] ; then
+       kill $LOCKTOUCHPID
+       lockfile-remove $LOCKFILE
+fi
+
+) &
diff --git a/recipes/ntp/ntp-4.2.6p3/tickadj.c.patch b/recipes/ntp/ntp-4.2.6p3/tickadj.c.patch
new file mode 100644 (file)
index 0000000..9ef9de9
--- /dev/null
@@ -0,0 +1,32 @@
+Index: ntp-4.2.2p3-r0/ntp-4.2.2p3/util/tickadj.c
+===================================================================
+--- ntp-4.2.2p3/util/tickadj.c 2004-02-25 06:58:33.000000000 +0100
++++ ntp-4.2.2p3/util/tickadj.c 2007-07-07 01:00:54.000000000 +0200
+@@ -21,7 +21,8 @@
+ # include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
+-#ifdef HAVE___ADJTIMEX                /* Linux */
++/* proper handling here has been moved to upstream ntp bugzilla */
++#ifdef linux
+ #include <sys/timex.h>
+ struct timex txc;
+@@ -91,7 +92,7 @@
+       }
+       if (!errflg) {
+-              if (__adjtimex(&txc) < 0)
++              if (adjtimex(&txc) < 0)
+                       perror("adjtimex");
+               else if (!quiet)
+                       printf("tick     = %ld\ntick_adj = %d\n",
+@@ -146,7 +147,7 @@
+ #endif
+       }
+     
+-      if (__adjtimex(&txc) < 0)
++      if (adjtimex(&txc) < 0)
+       {
+               perror("adjtimex");
+       }
diff --git a/recipes/ntp/ntp_4.2.6p3.bb b/recipes/ntp/ntp_4.2.6p3.bb
new file mode 100644 (file)
index 0000000..d17eb56
--- /dev/null
@@ -0,0 +1,44 @@
+require ntp.inc
+
+SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${P}.tar.gz \
+        file://tickadj.c.patch \
+        file://ntp-4.2.4_p6-nano.patch \
+        file://ntpd \
+        file://ntp.conf \
+        file://ntpdate"
+
+SRC_URI[md5sum] = "59876a9009b098ff59767ee45a88ebd2"
+SRC_URI[sha256sum] = "6e84d4ddfa14b911c3ed88463af10867e1fa9b287e7b34d8a02e78be85a7c40e"
+
+EXTRA_OECONF += " --with-net-snmp-config=no --without-ntpsnmpd" 
+
+do_install_append() {
+        install -d ${D}/${sysconfdir}/init.d
+        install -m 644 ${WORKDIR}/ntp.conf ${D}/${sysconfdir}
+        install -m 755 ${WORKDIR}/ntpd ${D}/${sysconfdir}/init.d
+        install -d ${D}/${sysconfdir}/network/if-up.d
+        install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d
+}
+
+FILES_${PN}-bin = "${bindir}/ntp-wait ${bindir}/ntpdc ${bindir}/ntpq ${bindir}/ntptime ${bindir}/ntptrace"
+FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd"
+FILES_${PN}-tickadj = "${bindir}/tickadj"
+FILES_ntp-utils = "${bindir}/*"
+FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/network/if-up.d/ntpdate"
+
+# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms
+# with wonky clocks (e.g. OpenSlug)
+RDEPENDS_${PN} = "${PN}-tickadj"
+
+pkg_postinst_ntpdate() {
+if test "x$D" != "x"; then
+        exit 1
+else
+        if ! grep -q -s ntpdate /var/cron/tabs/root; then
+                echo "adding crontab"
+                test -d /var/cron/tabs || mkdir -p /var/cron/tabs
+                echo "30 * * * *    /usr/bin/ntpdate -s -u pool.ntp.org" >> /var/cron/tabs/root
+        fi
+fi
+}
+