From a9bbe5f2a28cae548e84d1d0602d4415b5f6f659 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 25 Dec 2009 01:59:39 +0100 Subject: [PATCH] ntp: Initial import (verified compilation) --- ntp/.footprint | 38 ++++++++++++++++++++++++++ ntp/.md5sum | 5 ++++ ntp/Pkgfile | 54 +++++++++++++++++++++++++++++++++++++ ntp/ntp-64bit.diff | 17 ++++++++++++ ntp/ntp.conf | 66 ++++++++++++++++++++++++++++++++++++++++++++++ ntp/ntpd | 23 ++++++++++++++++ ntp/ntpdate | 20 ++++++++++++++ 7 files changed, 223 insertions(+) create mode 100644 ntp/.footprint create mode 100644 ntp/.md5sum create mode 100644 ntp/Pkgfile create mode 100644 ntp/ntp-64bit.diff create mode 100644 ntp/ntp.conf create mode 100755 ntp/ntpd create mode 100755 ntp/ntpdate diff --git a/ntp/.footprint b/ntp/.footprint new file mode 100644 index 0000000..d21c8f2 --- /dev/null +++ b/ntp/.footprint @@ -0,0 +1,38 @@ +drwxr-xr-x root/root etc/ +drwxr-xr-x root/root etc/ntp/ +-rw-r--r-- root/root etc/ntp/ntp.conf +drwxr-xr-x root/root etc/rc.d/ +-rwxr-xr-x root/root etc/rc.d/ntpd +-rwxr-xr-x root/root etc/rc.d/ntpdate +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/ntp-keygen +-rwxr-xr-x root/root usr/bin/ntp-wait +-rwxr-xr-x root/root usr/bin/ntpd +-rwxr-xr-x root/root usr/bin/ntpdate +-rwxr-xr-x root/root usr/bin/ntpdc +-rwxr-xr-x root/root usr/bin/ntpq +-rwxr-xr-x root/root usr/bin/ntptime +-rwxr-xr-x root/root usr/bin/ntptrace +-rwxr-xr-x root/root usr/bin/sntp +-rwxr-xr-x root/root usr/bin/tickadj +drwxr-xr-x root/root usr/lib/ +drwxr-xr-x root/root usr/man/ +drwxr-xr-x root/root usr/man/man1/ +-rw-r--r-- root/root usr/man/man1/ntp-keygen.1.gz +-rw-r--r-- root/root usr/man/man1/ntpd.1.gz +-rw-r--r-- root/root usr/man/man1/ntpdc.1.gz +-rw-r--r-- root/root usr/man/man1/ntpq.1.gz +-rw-r--r-- root/root usr/man/man1/ntpsnmpd.1.gz +-rw-r--r-- root/root usr/man/man1/sntp.1.gz +drwxr-xr-x root/root usr/man/man5/ +drwxr-xr-x root/root usr/man/man8/ +drwxr-xr-x root/root var/ +drwxr-xr-x root/root var/lib/ +drwxr-xr-x root/root var/lib/ntp/ +-rw-r--r-- root/root var/lib/ntp/ntp.drift +drwxr-xr-x root/root var/lib/ntp/stats/ +drwxr-xr-x root/root var/log/ +-rw-r--r-- root/root var/log/ntp.log (EMPTY) +drwxr-xr-x root/root var/run/ +drwxr-xr-x root/root var/run/ntp/ diff --git a/ntp/.md5sum b/ntp/.md5sum new file mode 100644 index 0000000..24b842e --- /dev/null +++ b/ntp/.md5sum @@ -0,0 +1,5 @@ +4d64a99592b818aa9419fc9dcb149746 ntp-4.2.6.tar.gz +0c5675c46a226de4504f5b855326b6b7 ntp-64bit.diff +de14b18b5f2be841a9c3434012c19f6c ntp.conf +2aaeeae50b860296490b03dc5fbe1736 ntpd +3714dba66445d1b41d6c699447c7a65e ntpdate diff --git a/ntp/Pkgfile b/ntp/Pkgfile new file mode 100644 index 0000000..3c4ad19 --- /dev/null +++ b/ntp/Pkgfile @@ -0,0 +1,54 @@ +# Description: Network Time Protocol software +# URL: http://www.ntp.org +# Packager: James Mills, prologic at shortcircuit dot net dot au +# Maintainer: Thomas Penteker, tek at serverop dot de +# Arch Maintainer: CRUX-ARM System Team, crux-arm at mikeux dot dyndns dot org +# Depends on: openssl + +name=ntp +version=4.2.6 +release=1 +source=(http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/$name-$version.tar.gz + ntpd + ntpdate + ntp.conf + ntp-64bit.diff) + +build () { + mkdir -p $PKG/etc/{rc.d,ntp} \ + $PKG/var/log \ + $PKG/var/run/ntp \ + $PKG/var/lib/ntp/stats \ + $PKG/usr/man/{man8,man5} + + cd $name-$version + patch -p1 < $SRC/ntp-64bit.diff + ./configure --build=$CHOST \ + --host=$CTARGET \ + --prefix=/usr \ + --mandir=/usr/man \ + --with-sntp \ + --with-crypto \ + --enable-debugging=no \ + --enable-ntpdate-step \ + --enable-parse-clocks \ + --enable-all-clocks \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$LDFLAGS" + + # substitute the default configuration path + sed -i -e 's;\(CONFIG_FILE[^"]*"\)/etc/ntp.conf;\1/etc/ntp/ntp.conf;' \ + include/ntp_config.h ntpdate/ntptime_config.c + + make + make DESTDIR=$PKG install + rm -r $PKG/usr/sbin + touch $PKG/var/log/ntp.log + + install -m 644 $SRC/ntp.conf $PKG/etc/ntp + install -m 755 $SRC/ntpd $PKG/etc/rc.d + install -m 755 $SRC/ntpdate $PKG/etc/rc.d + + # initialize ntp.drift file + echo "0.0" > $PKG/var/lib/ntp/ntp.drift +} diff --git a/ntp/ntp-64bit.diff b/ntp/ntp-64bit.diff new file mode 100644 index 0000000..281cc99 --- /dev/null +++ b/ntp/ntp-64bit.diff @@ -0,0 +1,17 @@ +--- a/include/ntp_syscall.h 2009-05-19 16:44:55.048156467 -0400 ++++ b/include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400 +@@ -14,6 +14,14 @@ + # include + #endif + ++#if defined(ADJ_NANO) && !defined(MOD_NANO) ++#define MOD_NANO ADJ_NANO ++#endif ++ ++#if defined(ADJ_TAI) && !defined(MOD_TAI) ++#define MOD_TAI ADJ_TAI ++#endif ++ + #ifndef NTP_SYSCALLS_LIBC + #ifdef NTP_SYSCALLS_STD + # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) diff --git a/ntp/ntp.conf b/ntp/ntp.conf new file mode 100644 index 0000000..108c0cc --- /dev/null +++ b/ntp/ntp.conf @@ -0,0 +1,66 @@ +# +# /etc/ntp/ntp.conf: ntp configuration +# + +############################################################################### +# Default paths + +logfile /var/log/ntp.log +pidfile /var/run/ntp/ntpd.pid +driftfile /var/lib/ntp/ntp.drift +#statsdir /var/lib/ntp/stats/ + +############################################################################### +# Authentication stuff +# +# keys /etc/ntp/ntp.keys # path for keys file +# trustedkey 1 2 3 4 5 6 14 15 # define trusted keys +# requestkey 15 # key (7) for accessing server variables +# controlkey 15 # key (6) for accessing server variables + +############################################################################### +# Undisciplined Local Clock. This is a fake driver intended for backup +# and when no outside source of synchronized time is available. + +server 127.127.1.0 # local clock (LCL) +fudge 127.127.1.0 stratum 10 # LCL is unsynchronized + + +## Generic DCF77 clock on serial port (Conrad DCF77) +## Address: 127.127.8.u +## Serial Port: /dev/refclock-u +## Sample project: http://www.obbl-net.de/dcf77.html by Martin Opel +## +## u = Number of your serial port +## +## (create soft link /dev/refclock-0 to the particular ttyS?) +## +# server 127.127.8.0 mode 5 prefer + + +############################################################################### +# Specify the servers you are interested in + +server ntps1-0.cs.tu-berlin.de prefer +server ntps1-1.cs.tu-berlin.de +server ntp1.ptb.de +server ntp1.fau.de + +############################################################################### +# Then we restrict the type of access you allow these servers. +# Were not allowing them to modify or query our Linux NTP server + +restrict default ignore notrust nomodify notrap +restrict 127.0.0.1 +#restrict +restrict ntps1-0.cs.tu-berlin.de mask 255.255.255.255 nomodify notrap noquery +restrict ntps1-1.cs.tu-berlin.de mask 255.255.255.255 nomodify notrap noquery +restrict ntp1.ptb.de mask 255.255.255.255 nomodify notrap noquery +restrict ntp1.fau.de mask 255.255.255.255 nomodify notrap noquery + +# Now list the NTP clients on our home network which should be able to query +# our server for the time (notice that the noquery has been removed) + +#restrict 192.168.0.0 mask 255.255.255.0 + +# End of file diff --git a/ntp/ntpd b/ntp/ntpd new file mode 100755 index 0000000..c66e461 --- /dev/null +++ b/ntp/ntpd @@ -0,0 +1,23 @@ +#!/bin/sh +# +# /etc/rc.d/ntpd: start/stop ntp daemon +# + +case $1 in +start) + /usr/bin/ntpd -gqx + /usr/bin/ntpd + ;; +stop) + /sbin/hwclock -w + killall -q /usr/bin/ntpd + ;; +restart) + $0 stop && sleep 3 && $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/ntp/ntpdate b/ntp/ntpdate new file mode 100755 index 0000000..539f283 --- /dev/null +++ b/ntp/ntpdate @@ -0,0 +1,20 @@ +#!/bin/sh +# +# /etc/rc.d/ntpdate: sync time via ntp +# + +case $1 in +start) + /usr/bin/ntpdate pool.ntp.org 1>/dev/null & + ;; +stop) + ;; +restart) + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file -- 2.26.2