From f3b88a74a85c8a877dbdcb61ed10fcca9b012c47 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 6 Mar 2018 19:46:00 +0000
Subject: ntp: update to 4.2.8.p10

---
 abs/core/ntp/PKGBUILD        | 67 +++++++++++++++++---------------------------
 abs/core/ntp/install         | 37 ------------------------
 abs/core/ntp/logrotate.d     |  4 ---
 abs/core/ntp/ntp.conf        | 31 ++++++++++----------
 abs/core/ntp/ntp.install     |  5 ++++
 abs/core/ntp/ntpd            | 47 -------------------------------
 abs/core/ntp/ntpd.conf       |  5 ----
 abs/core/ntp/ntpd.service    |  9 +++---
 abs/core/ntp/ntpdate         | 29 -------------------
 abs/core/ntp/ntpdate.service | 12 ++++++++
 10 files changed, 63 insertions(+), 183 deletions(-)
 delete mode 100644 abs/core/ntp/install
 delete mode 100644 abs/core/ntp/logrotate.d
 create mode 100644 abs/core/ntp/ntp.install
 delete mode 100755 abs/core/ntp/ntpd
 delete mode 100644 abs/core/ntp/ntpd.conf
 delete mode 100755 abs/core/ntp/ntpdate
 create mode 100644 abs/core/ntp/ntpdate.service

diff --git a/abs/core/ntp/PKGBUILD b/abs/core/ntp/PKGBUILD
index 3da7795..2ea5e1c 100644
--- a/abs/core/ntp/PKGBUILD
+++ b/abs/core/ntp/PKGBUILD
@@ -1,64 +1,47 @@
-# $Id: PKGBUILD 162162 2012-06-22 12:59:21Z dreisner $
-# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
+# Contributor: Gaetan Bisson <bisson@archlinux.org>
 # Contributor: kevin <kevin@archlinux.org>
 
 pkgname=ntp
-pkgver=4.2.6.p5
-_realver=4.2.6p5
-pkgrel=7
+_pkgname=ntp #-dev
+_pkgver=4.2.8p10
+pkgver=${_pkgver/p/.p}
+pkgrel=2
 pkgdesc='Network Time Protocol reference implementation'
 url='http://www.ntp.org/'
 license=('custom')
-arch=('i686' 'x86_64')
-makedepends=('perl-html-parser')
-depends=('openssl' 'readline' 'libcap')
-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'
+arch=('x86_64')
+depends=('openssl' 'libcap' 'libedit')
+backup=('etc/ntp.conf')
+source=("https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${_pkgname}-${_pkgver}.tar.gz"
         'ntp.conf'
-        'ntpd.conf'
-        'logrotate.d'
-        'ntpd.service')
-sha1sums=('4a5353a4791b6f4315a66c28d504ec6c7926b192'
-          '4e324e625c1f080b5c028be5092aa71adbf9bd99'
-          '01394b8a952f5edc85d19df8335eeac3980320f4'
-          'eb1f63814b9adbd3d518e880fa3b38c375f0fe91'
-          '4537d1f58b299d463db5048129cb264511474b0b'
-          '4f76f7f9ffc8315ff9924f793f272d4f6939b816'
-          '81df5c4d51cb69bc29363625ff49e2bd388d1fa9')
+        'ntpd.service'
+        'ntpdate.service')
+sha1sums=('503d68cfd3e6a9354e0e28dd38b39d850b1228b2'
+          'ad1d6ee2e9aca64a84a7224c88bf6008ac6c69e1'
+          '0cccca872385e0142888ab48d273fec0669b30a8'
+          '059b382d1af0c55202e2d17f2ae065a2cbfec9ee')
 
-install=install
+options=('!emptydirs')
+install=ntp.install
 
 build() {
-	cd "${srcdir}/${pkgname}-${_realver}"
-
-	./configure \
-		--prefix=/usr \
-		--mandir=/usr/share/man \
-		--enable-linuxcaps \
+	cd "${srcdir}/${_pkgname}-${_pkgver}"
 
+	./configure --prefix=/usr --libexecdir=/usr/lib --enable-linuxcaps --enable-ntp-signd
 	make
 }
 
 package() {
-	cd "${srcdir}/${pkgname}-$_realver"
+	cd "${srcdir}/${_pkgname}-${_pkgver}"
 
 	make DESTDIR="${pkgdir}" install
 
-	rmdir "${pkgdir}"/usr/{lib,sbin}
-	install -d -o 87 "${pkgdir}"/var/lib/ntp
-	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
-	install -Dm644 ../logrotate.d "${pkgdir}"/etc/logrotate.d/ntpd
 	install -Dm644 ../ntpd.service "${pkgdir}"/usr/lib/systemd/system/ntpd.service
+	install -Dm644 ../ntpdate.service "${pkgdir}"/usr/lib/systemd/system/ntpdate.service
 	install -Dm644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
-	
-	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
+
+	install -d -o 87 "${pkgdir}"/var/lib/ntp
+	echo > "${pkgdir}/var/lib/ntp/.placeholder"
 }
diff --git a/abs/core/ntp/install b/abs/core/ntp/install
deleted file mode 100644
index e6eddf8..0000000
--- a/abs/core/ntp/install
+++ /dev/null
@@ -1,37 +0,0 @@
-post_install() {
-	getent group ntp &>/dev/null || groupadd -g 87 ntp >/dev/null
-	getent passwd ntp &>/dev/null || useradd -u 87 -g ntp -d /var/lib/ntp -c 'Network Time Protocol' -s /bin/false ntp >/dev/null
-	true
-}
-
-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
-	if [[ $(vercmp $2 4.2.6.p5-3) -le 0 ]]; then
-		post_install
-	fi
-	if [[ $(vercmp $2 4.2.6.p5-5) -le 0 ]]; then
-		chown -R ntp /var/lib/ntp
-	fi
-}
-
-post_remove() {
-	getent passwd ntp &>/dev/null && userdel ntp >/dev/null
-	getent group ntp &>/dev/null && groupdel ntp >/dev/null
-	true
-}
diff --git a/abs/core/ntp/logrotate.d b/abs/core/ntp/logrotate.d
deleted file mode 100644
index 8a9f066..0000000
--- a/abs/core/ntp/logrotate.d
+++ /dev/null
@@ -1,4 +0,0 @@
-/var/log/ntp.log {
-	missingok
-	copytruncate
-}
diff --git a/abs/core/ntp/ntp.conf b/abs/core/ntp/ntp.conf
index a27b228..4debe96 100644
--- a/abs/core/ntp/ntp.conf
+++ b/abs/core/ntp/ntp.conf
@@ -1,23 +1,24 @@
-# With the default settings below, ntpd will only synchronize your clock.
+# Please consider joining the pool:
 #
-# For details, see:
-# - the ntp.conf man page
-# - http://support.ntp.org/bin/view/Support/GettingStarted
+#     http://www.pool.ntp.org/join.html
+#
+# For additional information see:
 # - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
+# - http://support.ntp.org/bin/view/Support/GettingStarted
+# - the ntp.conf man page
 
-# Associate to public NTP pool servers; see http://www.pool.ntp.org/
-server 0.pool.ntp.org
-server 1.pool.ntp.org
-server 2.pool.ntp.org
+# Associate to Arch's NTP pool
+server 0.arch.pool.ntp.org
+server 1.arch.pool.ntp.org
+server 2.arch.pool.ntp.org
+server 3.arch.pool.ntp.org
 
-# Only allow read-only access from localhost
-restrict default noquery nopeer
+# By default, the server allows:
+# - all queries from the local host
+# - only time queries from remote hosts, protected by rate limiting and kod
+restrict default kod limited nomodify nopeer noquery notrap
 restrict 127.0.0.1
 restrict ::1
 
-# Location of drift and log files
+# Location of drift file
 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/abs/core/ntp/ntp.install b/abs/core/ntp/ntp.install
new file mode 100644
index 0000000..4df9f78
--- /dev/null
+++ b/abs/core/ntp/ntp.install
@@ -0,0 +1,5 @@
+post_install() {
+	getent group ntp &>/dev/null || groupadd -g 87 ntp >/dev/null
+	getent passwd ntp &>/dev/null || useradd -u 87 -g ntp -d /var/lib/ntp -c 'Network Time Protocol' -s /bin/false ntp >/dev/null
+	true
+}
diff --git a/abs/core/ntp/ntpd b/abs/core/ntp/ntpd
deleted file mode 100755
index 480fa10..0000000
--- a/abs/core/ntp/ntpd
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/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/abs/core/ntp/ntpd.conf b/abs/core/ntp/ntpd.conf
deleted file mode 100644
index 047961f..0000000
--- a/abs/core/ntp/ntpd.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# client options for "ntpd -q" - ntpdate equivalent
-NTP_CLIENT_OPTION="-g -u ntp"
-
-# arguments passed to ntpd when started
-NTPD_ARGS="-g -u ntp"
diff --git a/abs/core/ntp/ntpd.service b/abs/core/ntp/ntpd.service
index e0cbf87..267615c 100644
--- a/abs/core/ntp/ntpd.service
+++ b/abs/core/ntp/ntpd.service
@@ -1,12 +1,13 @@
 [Unit]
 Description=Network Time Service
-After=network.target
+After=network.target nss-lookup.target
+Conflicts=systemd-timesyncd.service
 
 [Service]
 Type=forking
-PIDFile=/run/ntpd.pid
-EnvironmentFile=/etc/conf.d/ntpd.conf
-ExecStart=/usr/bin/ntpd $NTPD_ARGS -p /run/ntpd.pid
+PrivateTmp=true
+ExecStart=/usr/bin/ntpd -g -u ntp:ntp
+Restart=always
 
 [Install]
 WantedBy=multi-user.target
diff --git a/abs/core/ntp/ntpdate b/abs/core/ntp/ntpdate
deleted file mode 100755
index a8e7467..0000000
--- a/abs/core/ntp/ntpdate
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/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
diff --git a/abs/core/ntp/ntpdate.service b/abs/core/ntp/ntpdate.service
new file mode 100644
index 0000000..e85852e
--- /dev/null
+++ b/abs/core/ntp/ntpdate.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=One-Shot Network Time Service
+After=network.target nss-lookup.target
+Before=ntpd.service
+
+[Service]
+Type=oneshot
+PrivateTmp=true
+ExecStart=/usr/bin/ntpd -q -n -g -u ntp:ntp
+
+[Install]
+WantedBy=multi-user.target
-- 
cgit v0.12

