aboutsummaryrefslogtreecommitdiffstats
path: root/extra/chrony
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-31 14:02:54 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-31 14:02:54 +0000
commit4fb36e68906b5c78f79942d7b7df78622d009dbb (patch)
treefe8b4e25c6a65513dc0eecd66ae5ad33e7375794 /extra/chrony
parent11f2e6fdf01f5bfcc096772aaf6aa396ec066a0c (diff)
downloadaports-4fb36e68906b5c78f79942d7b7df78622d009dbb.tar.bz2
aports-4fb36e68906b5c78f79942d7b7df78622d009dbb.tar.xz
extra/chrony: new aport
NTP client and server programs http://chrony.sunsite.dk/
Diffstat (limited to 'extra/chrony')
-rw-r--r--extra/chrony/APKBUILD54
-rw-r--r--extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff46
-rw-r--r--extra/chrony/chrony-1.20-conf.c-gentoo.diff11
-rw-r--r--extra/chrony/chrony-1.21-makefile.diff15
-rw-r--r--extra/chrony/chrony-1.23-sources.diff56
-rw-r--r--extra/chrony/chronyd.confd18
-rw-r--r--extra/chrony/chronyd.initd58
7 files changed, 258 insertions, 0 deletions
diff --git a/extra/chrony/APKBUILD b/extra/chrony/APKBUILD
new file mode 100644
index 0000000000..3c3fbce7a6
--- /dev/null
+++ b/extra/chrony/APKBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=chrony
+pkgver=1.23
+pkgrel=0
+pkgdesc="NTP client and server programs"
+url="http://chrony.sunsite.dk/"
+license="GPL-2"
+depends="uclibc"
+makedepends="texinfo"
+subpackages="$pkgname-doc"
+source="http://chrony.sunsite.dk/download/$pkgname-$pkgver.tar.gz
+ $pkgname-1.20-conf.c-gentoo.diff
+ $pkgname-1.20-chrony.conf.example-gentoo.diff
+ $pkgname-1.21-makefile.diff
+ $pkgname-1.23-sources.diff
+ chronyd.confd
+ chronyd.initd
+ "
+
+build() {
+ local i
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for i in ../*.diff; do
+ msg "Applying $i"
+ patch -p1 < $i || return 1
+ done
+ sed -i "s:/etc/chrony:/etc/chrony/chrony:g" \
+ chrony*.[158] faq.txt chrony.texi || die "sed failed"
+
+ ./configure --prefix=/usr \
+ --infodir=/usr/share/info \
+ --mandir=/usr/share/man \
+ --disable-readline
+
+ make all docs || return 1
+ make DESTDIR="$pkgdir" install
+
+ mv "$pkgdir"/usr/doc "$pkgdir"/usr/share/
+ install -D -m644 examples/*.example "$pkgdir"/usr/share/doc/chrony/
+
+ install -m755 -D "$srcdir"/chronyd.initd "$pkgdir"/etc/init.d/chronyd
+ install -m644 -D "$srcdir"/chronyd.confd "$pkgdir"/etc/conf.d/chronyd
+ mkdir -p "$pkgdir"/var/lib/chrony \
+ "$pkgdir"/var/log/chrony \
+ "$pkgdir"/etc/chrony
+}
+md5sums="ffce77695e55d8efda19ab0b78309c23 chrony-1.23.tar.gz
+bd6bd57363865d3ed0c3187d0c9f7151 chrony-1.20-conf.c-gentoo.diff
+b2a23e02f7af50bebdd5d18bccdedbf0 chrony-1.20-chrony.conf.example-gentoo.diff
+d47015a34b6b2f9eebca77ef939cec72 chrony-1.21-makefile.diff
+39cbce9f66638b67623e1ee6bb0f943f chrony-1.23-sources.diff
+d5c09be46226774d22c08c5a4c28093a chronyd.confd
+dac8aa4913d7c323abfa1719ddd7e5e4 chronyd.initd"
diff --git a/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff b/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
new file mode 100644
index 0000000000..498b241750
--- /dev/null
+++ b/extra/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
@@ -0,0 +1,46 @@
+--- a/examples/chrony.conf.example.orig 2003-06-16 11:59:01.000000000 -0400
++++ b/examples/chrony.conf.example 2003-06-16 12:00:13.000000000 -0400
+@@ -3,5 +3,5 @@
+ #
+ # This is an example chrony configuration file. You should copy it to
+-# /etc/chrony.conf after uncommenting and editing the options that you
++# /etc/chrony/chrony.conf after uncommenting and editing the options that you
+ # want to enable. I have not included the more obscure options. Refer
+ # to the documentation for these.
+@@ -91,5 +91,5 @@
+ # generally want this, so it is uncommented.
+
+-driftfile /etc/chrony.drift
++driftfile /etc/chrony/chrony.drift
+
+ # If you want to use the program called chronyc to configure aspects of
+@@ -100,5 +100,5 @@
+ # assumed by default.
+
+-keyfile /etc/chrony.keys
++keyfile /etc/chrony/chrony.keys
+
+ # Tell chronyd which numbered key in the file is used as the password
+@@ -158,6 +158,6 @@
+ ! log measurements statistics tracking
+
+-If you have real time clock support enabled (see below), you might want
+-this line instead:
++# If you have real time clock support enabled (see below), you might want
++# this line instead:
+
+ ! log measurements statistics tracking rtc
+@@ -269,5 +269,5 @@
+ # kernel. (Note, these options apply only to Linux.)
+
+-! rtcfile /etc/chrony.rtc
++! rtcfile /etc/chrony/chrony.rtc
+
+ # Your RTC can be set to keep Universal Coordinated Time (UTC) or local
+@@ -285,5 +285,5 @@
+ # using devfs), uncomment and edit the following line.
+
+-! rtcdevice /dev/misc/rtc
++rtcdevice /dev/misc/rtc
+
+ #######################################################################
diff --git a/extra/chrony/chrony-1.20-conf.c-gentoo.diff b/extra/chrony/chrony-1.20-conf.c-gentoo.diff
new file mode 100644
index 0000000000..4917d445be
--- /dev/null
+++ b/extra/chrony/chrony-1.20-conf.c-gentoo.diff
@@ -0,0 +1,11 @@
+--- a/conf.c.orig Sun May 12 14:07:31 2002
++++ b/conf.c Sun May 12 14:07:52 2002
+@@ -45,7 +45,7 @@
+
+ /* ================================================== */
+
+-#define DEFAULT_CONF_FILE "/etc/chrony.conf"
++#define DEFAULT_CONF_FILE "/etc/chrony/chrony.conf"
+
+ /* ================================================== */
+ /* Forward prototypes */
diff --git a/extra/chrony/chrony-1.21-makefile.diff b/extra/chrony/chrony-1.21-makefile.diff
new file mode 100644
index 0000000000..2eec4e8428
--- /dev/null
+++ b/extra/chrony/chrony-1.21-makefile.diff
@@ -0,0 +1,15 @@
+--- a/Makefile.in_old 2006-08-12 17:42:57.000000000 +0200
++++ b/Makefile.in 2006-08-12 17:44:35.000000000 +0200
+@@ -68,10 +68,10 @@
+ all : chronyd chronyc
+
+ chronyd : $(OBJS) $(EXTRA_OBJS)
+- $(CC) $(OPTFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
+
+ chronyc : $(CLI_OBJS)
+- $(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
++ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
+
+ client.o : client.c
+ $(CC) $(CFLAGS) $(DEFS) @READLINE_COMPILE@ -c $<
diff --git a/extra/chrony/chrony-1.23-sources.diff b/extra/chrony/chrony-1.23-sources.diff
new file mode 100644
index 0000000000..5f39ca3321
--- /dev/null
+++ b/extra/chrony/chrony-1.23-sources.diff
@@ -0,0 +1,56 @@
+commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425
+Author: Goswin Brederlow <brederlo@informatik.uni-tuebingen.de>
+Date: Sat Mar 29 20:49:59 2008 +0000
+
+ Fix for chronyc "sources" command on 64 bit machines
+
+ (Taken from
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412
+ )
+
+ Attached is a patchlet to make the "sources" command of chrony output properly
+ signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and
+ friends to get the right number of bits per datatype while client.c just uses
+ short, int, long. But long will be 64 bit or 32 bit depending on the cpu.
+
+diff --git a/client.c b/client.c
+index b7e5bcb..85d6e84 100644
+--- a/client.c
++++ b/client.c
+@@ -45,6 +45,12 @@
+ #include <readline/history.h>
+ #endif
+
++#ifdef HAS_STDINT_H
++#include <stdint.h>
++#elif defined(HAS_INTTYPES_H)
++#include <inttypes.h>
++#endif
++
+ /* ================================================== */
+
+ static int sock_fd;
+@@ -1383,16 +1389,16 @@ process_cmd_sources(char *line)
+ int n_sources, i;
+ int verbose = 0;
+
+- long orig_latest_meas, latest_meas, est_offset;
+- unsigned long ip_addr;
+- unsigned long latest_meas_err, est_offset_err;
+- unsigned long latest_meas_ago;
+- unsigned short poll, stratum;
+- unsigned short state, mode;
++ int32_t orig_latest_meas, latest_meas, est_offset;
++ uint32_t ip_addr;
++ uint32_t latest_meas_err, est_offset_err;
++ uint32_t latest_meas_ago;
++ uint16_t poll, stratum;
++ uint16_t state, mode;
+ double resid_freq, resid_skew;
+ const char *dns_lookup;
+ char hostname_buf[32];
+- unsigned short status;
++ uint16_t status;
+
+ /* Check whether to output verbose headers */
+ verbose = check_for_verbose_flag(line);
diff --git a/extra/chrony/chronyd.confd b/extra/chrony/chronyd.confd
new file mode 100644
index 0000000000..560825c2c8
--- /dev/null
+++ b/extra/chrony/chronyd.confd
@@ -0,0 +1,18 @@
+# /etc/conf.d/chronyd
+
+CFGFILE="/etc/chrony/chrony.conf"
+
+# Configuration dependant options :
+# -s - Set system time from RTC if rtcfile directive present
+# -r - Reload sample histories if dumponexit directive present
+#
+# The combination of "-s -r" allows chronyd to perform long term averaging of
+# the gain or loss rate across system reboots and shutdowns.
+
+ARGS=""
+
+# devfs creates the device for RTC if it's compiled into kernel
+test -c /dev/rtc && {
+ grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s"
+}
+grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r"
diff --git a/extra/chrony/chronyd.initd b/extra/chrony/chronyd.initd
new file mode 100644
index 0000000000..49d7526bb5
--- /dev/null
+++ b/extra/chrony/chronyd.initd
@@ -0,0 +1,58 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/chrony/files/chronyd.rc,v 1.8 2007/03/22 14:32:09 tove Exp $
+
+depend() {
+ need net
+ use dns
+}
+
+checkconfig() {
+ # Note that /etc/chrony/chrony.keys is *NOT* checked. This
+ # is because the user may have specified another key
+ # file, and we don't want to force the user to use that
+ # exact name for the key file.
+ if [ ! -f "${CFGFILE}" ] ; then
+ eerror "Please create ${CFGFILE} and the"
+ eerror "chrony key file (usually /etc/chrony/chrony.keys)"
+ eerror "by using the"
+ eerror ""
+ eerror " chrony.conf.example"
+ eerror " chrony.keys.example"
+ eerror ""
+ eerror "files (from the documentation directory)"
+ eerror "as templates."
+ return 1
+ else
+ # Actually, I tried it, and chrony seems to ignore the pidfile
+ # option. I'm going to leave it here anyway, since you never
+ # know if it might be handy
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
+
+ ebegin "Starting chronyd"
+ start-stop-daemon --start --quiet \
+ --exec /usr/sbin/chronyd \
+ --pidfile "${PIDFILE}" \
+ -- -f "${CFGFILE}" ${ARGS}
+ eend $? "Failed to start chronyd"
+}
+
+stop() {
+ checkconfig || return $?
+
+ [ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
+
+ ebegin "Stopping chronyd"
+ start-stop-daemon --stop --quiet \
+ --pidfile "${PIDFILE}"
+ eend $? "Failed to stop chronyd"
+}