[pkg-ntp-maintainers] [pkg-ntp] 01/02: Add systemd unit
Bernhard Schmidt
berni at moszumanska.debian.org
Thu May 11 10:59:39 UTC 2017
This is an automated email from the git hooks/post-receive script.
berni pushed a commit to branch berni-wip
in repository pkg-ntp.
commit 6925f6c612a7246263625f5cbf59b37688fe0ba4
Author: Bernhard Schmidt <berni at debian.org>
Date: Thu May 11 09:34:07 2017 +0200
Add systemd unit
As the existing SysV init script does a few things that
cannot be natively expressed in systemd (use of DHCP-
provided NTP servers if available, selection of UID) we
have opted to use a shell wrapper for compatibility
Closes: #635752
---
debian/ntp-systemd-wrapper | 18 ++++++++++++++++++
debian/ntp.install | 1 +
debian/ntp.service | 15 +++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/debian/ntp-systemd-wrapper b/debian/ntp-systemd-wrapper
new file mode 100755
index 0000000..716b8ab
--- /dev/null
+++ b/debian/ntp-systemd-wrapper
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if [ -r /etc/default/ntp ]; then
+ . /etc/default/ntp
+fi
+
+if [ -e /run/ntp.conf.dhcp ]; then
+ NTPD_OPTS="$NTPD_OPTS -c /run/ntp.conf.dhcp"
+fi
+
+RUNASUSER=ntp
+UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
+if test "$(uname -s)" = "Linux"; then
+ NTPD_OPTS="$NTPD_OPTS -u $UGID"
+fi
+
+exec /usr/sbin/ntpd -p $PIDFILE $NTPD_OPTS
+
diff --git a/debian/ntp.install b/debian/ntp.install
index a794f1b..579d142 100644
--- a/debian/ntp.install
+++ b/debian/ntp.install
@@ -22,3 +22,4 @@ debian/tmp/usr/share/doc/ntp/ntptrace.html
debian/tmp/usr/share/doc/sntp/sntp.html
debian/tmp/usr/share/doc/ntp/update-leap.html
debian/tmp/usr/share/man/man*/*
+debian/ntp-systemd-wrapper usr/lib/ntp
diff --git a/debian/ntp.service b/debian/ntp.service
new file mode 100644
index 0000000..d384aa1
--- /dev/null
+++ b/debian/ntp.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Network Time Service
+Documentation=man:ntpd(8)
+After=network.target
+Conflicts=systemd-timesyncd.service
+
+[Service]
+Type=forking
+# Debian uses a shell wrapper to process /etc/default/ntp
+# and select DHCP-provided NTP servers if available
+ExecStart=/usr/lib/ntp/ntp-systemd-wrapper
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ntp/pkg-ntp.git
More information about the pkg-ntp-maintainers
mailing list