summaryrefslogtreecommitdiff
path: root/testing/ntp
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-12-27 23:14:54 +0000
committerroot <root@rshg054.dnsready.net>2011-12-27 23:14:54 +0000
commitb3288f94e625603d6b5b23740b721287e75eead7 (patch)
treeeff707b86ebe69b25cbd9f7b6549e7d8d76f4e46 /testing/ntp
parent342100843ef3e4379443c526403fac1b1cb6416a (diff)
Tue Dec 27 23:14:54 UTC 2011
Diffstat (limited to 'testing/ntp')
-rw-r--r--testing/ntp/PKGBUILD62
-rw-r--r--testing/ntp/install19
-rw-r--r--testing/ntp/ntp.conf23
-rwxr-xr-xtesting/ntp/ntpd47
-rw-r--r--testing/ntp/ntpd.conf5
-rwxr-xr-xtesting/ntp/ntpdate29
6 files changed, 185 insertions, 0 deletions
diff --git a/testing/ntp/PKGBUILD b/testing/ntp/PKGBUILD
new file mode 100644
index 000000000..92fee77b1
--- /dev/null
+++ b/testing/ntp/PKGBUILD
@@ -0,0 +1,62 @@
+# $Id: PKGBUILD 145678 2011-12-27 02:24:38Z bisson $
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Contributor: kevin <kevin@archlinux.org>
+
+pkgname=ntp
+pkgver=4.2.6.p5
+_realver=4.2.6p5
+pkgrel=2
+pkgdesc='Network Time Protocol reference implementation'
+url='http://www.ntp.org/'
+license=('custom')
+arch=('i686' 'x86_64')
+depends=('openssl' 'readline' 'libcap')
+makedepends=('perl-html-parser')
+backup=('etc/ntp.conf' 'etc/conf.d/ntpd.conf')
+source=("http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${_realver}.tar.gz"
+ 'ntpd'
+ 'ntpdate'
+ 'ntp.conf'
+ 'ntpd.conf')
+sha1sums=('4a5353a4791b6f4315a66c28d504ec6c7926b192'
+ '4e324e625c1f080b5c028be5092aa71adbf9bd99'
+ '01394b8a952f5edc85d19df8335eeac3980320f4'
+ 'f6fa4838a33a3abcdd168a37b3f4a2dddd60472e'
+ '6cfcb7bbd34499b30e31dffca2f3e1a036010271')
+
+install=install
+
+build() {
+ cd "${srcdir}/${pkgname}-${_realver}"
+
+ ./configure \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --enable-linux-caps \
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-$_realver"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -Dm755 ../ntpd "${pkgdir}"/etc/rc.d/ntpd
+ install -Dm755 ../ntpdate "${pkgdir}"/etc/rc.d/ntpdate
+ install -Dm644 ../ntp.conf "${pkgdir}"/etc/ntp.conf
+ install -Dm644 ../ntpd.conf "${pkgdir}"/etc/conf.d/ntpd.conf
+
+ cd html
+ ../scripts/html2man
+ install -d "${pkgdir}"/usr/share/man
+ mv man/man* "${pkgdir}"/usr/share/man
+ mv "${pkgdir}/usr/share/man/man8/ntpd.8" "${pkgdir}/usr/share/man/man8/ntp-ntpd.8" # we should ditch openntpd
+ cd ..
+
+ rmdir "${pkgdir}"/usr/{lib,sbin}
+ install -d "${pkgdir}/var/lib/ntp"
+ install -Dm644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ touch "${pkgdir}"/var/lib/ntp/.placeholder
+}
diff --git a/testing/ntp/install b/testing/ntp/install
new file mode 100644
index 000000000..926b4126e
--- /dev/null
+++ b/testing/ntp/install
@@ -0,0 +1,19 @@
+post_upgrade() {
+ if [[ $(vercmp $2 4.2.6.p3) -le 0 ]]; then
+ cat <<EOF
+
+==> The file /etc/conf.d/ntp-client.conf has been renamed /etc/conf.d/ntpd.conf
+==> If you made changes to the former, please update the latter.
+
+EOF
+ fi
+ if [[ $(vercmp $2 4.2.6.p5-1) -le 0 ]]; then
+ cat <<EOF
+
+==> The PID file /var/run/ntpd.pid has been renamed /run/ntpd.pid
+==> and the new rc.d script only takes the latter into account.
+==> To stop your old ntpd process, please kill it manually.
+
+EOF
+ fi
+}
diff --git a/testing/ntp/ntp.conf b/testing/ntp/ntp.conf
new file mode 100644
index 000000000..49b2f2bb7
--- /dev/null
+++ b/testing/ntp/ntp.conf
@@ -0,0 +1,23 @@
+# With the default settings below, ntpd will only synchronize your clock.
+#
+# For details, see:
+# - the ntp.conf man page
+# - http://support.ntp.org/bin/view/Support/GettingStarted
+# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
+
+# Select three geolocalized NTP public servers; see http://www.pool.ntp.org/
+server 0.pool.ntp.org
+server 1.pool.ntp.org
+server 2.pool.ntp.org
+
+# Only allow read-only access from localhost
+restrict default nomodify nopeer
+restrict 127.0.0.1
+restrict ::1
+
+# Location of drift and log files
+driftfile /var/lib/ntp/ntp.drift
+logfile /var/log/ntp.log
+
+# NOTE: If you run dhcpcd and have lines like 'restrict' and 'fudge' appearing
+# here, be sure to add '-Y -N' to the dhcpcd_ethX variables in /etc/conf.d/net
diff --git a/testing/ntp/ntpd b/testing/ntp/ntpd
new file mode 100755
index 000000000..480fa1088
--- /dev/null
+++ b/testing/ntp/ntpd
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ntpd.conf
+
+unset PID
+PIDFILE='/run/ntpd.pid'
+
+if [[ -r ${PIDFILE} ]]; then
+ read -r PID <"${PIDFILE}"
+ if [[ -n ${PID} && ! -d /proc/${PID} ]]; then
+ rm -f "${PIDFILE}"
+ unset PID
+ fi
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting NTP Daemon"
+ if [[ -z ${PID} ]] && /usr/bin/ntpd ${NTPD_ARGS} -p "${PIDFILE}" &>/dev/null; then
+ add_daemon ntpd
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Daemon"
+ if [[ -n ${PID} ]] && kill "${PID}" &>/dev/null; then
+ rm ${PIDFILE}
+ rm_daemon ntpd
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/testing/ntp/ntpd.conf b/testing/ntp/ntpd.conf
new file mode 100644
index 000000000..e728db579
--- /dev/null
+++ b/testing/ntp/ntpd.conf
@@ -0,0 +1,5 @@
+# client options for "ntpd -q" - ntpdate equivalent
+NTP_CLIENT_OPTION="-g"
+
+# arguments passed to ntpd when started
+NTPD_ARGS="-g"
diff --git a/testing/ntp/ntpdate b/testing/ntp/ntpdate
new file mode 100755
index 000000000..a8e746785
--- /dev/null
+++ b/testing/ntp/ntpdate
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ntpd.conf
+
+case "$1" in
+ start)
+ stat_busy "Starting NTP Client"
+ if /usr/bin/ntpd -q ${NTP_CLIENT_OPTION} &>/dev/null; then
+ add_daemon ntpdate
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Client"
+ rm_daemon ntpdate
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac