commit:     99c380a654731d45bbffe372e5c1aa59613c74f9
Author:     Stephen L Arnold <nerdboy <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 23 22:53:43 2018 +0000
Commit:     Steve Arnold <nerdboy <AT> gentoo <DOT> org>
CommitDate: Fri Feb 23 22:54:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99c380a6

net-misc/ntpsec: new ebuild for secure ntp daemon

* refactored version of NTP reference implementation
* integration with gpsd and vendor clock sources

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 net-misc/ntpsec/Manifest            |   1 +
 net-misc/ntpsec/files/ntpd.confd    |   7 +++
 net-misc/ntpsec/files/ntpd.rc-r1    |  23 ++++++++
 net-misc/ntpsec/files/ntpd.service  |  15 +++++
 net-misc/ntpsec/metadata.xml        |  34 ++++++++++++
 net-misc/ntpsec/ntpsec-1.0.0.ebuild | 106 ++++++++++++++++++++++++++++++++++++
 6 files changed, 186 insertions(+)

diff --git a/net-misc/ntpsec/Manifest b/net-misc/ntpsec/Manifest
new file mode 100644
index 00000000000..29e5507e1ee
--- /dev/null
+++ b/net-misc/ntpsec/Manifest
@@ -0,0 +1 @@
+DIST ntpsec-1.0.0.tar.gz 2405862 BLAKE2B 
b1631491500cafa5d41761fe6cb2db523450ed7801d06678048d6b8878d93dbd1e9d7cb2081a8400421213cf78a6724220236149a7f719896d1e8e48f5337d85
 SHA512 
9fb06310508b30d2ae2d66212d7d87b00e8eea294cebc27eb70435d764bd639fcec234b66e78deafb700476c88e47afe2d1b463563008c32efbb0644dd611f43

diff --git a/net-misc/ntpsec/files/ntpd.confd b/net-misc/ntpsec/files/ntpd.confd
new file mode 100644
index 00000000000..92c553a6261
--- /dev/null
+++ b/net-misc/ntpsec/files/ntpd.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/ntpd
+
+# Options to pass to the ntpd process
+# Most people should leave this line alone ...
+# however, if you know what you're doing, feel free to tweak
+#NTPD_OPTS="-g -n -u ntp:ntp"
+NTPD_OPTS="-g -u ntp:ntp"

diff --git a/net-misc/ntpsec/files/ntpd.rc-r1 b/net-misc/ntpsec/files/ntpd.rc-r1
new file mode 100644
index 00000000000..dbe76c85e53
--- /dev/null
+++ b/net-misc/ntpsec/files/ntpd.rc-r1
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="ntpd - the network time protocol daemon"
+pidfile="/var/run/ntpd.pid"
+command="/usr/sbin/ntpd"
+command_args="-p ${pidfile} ${NTPD_OPTS}"
+start_stop_daemon_args="--pidfile ${pidfile}"
+
+depend() {
+       use net dns logger
+       after ntp-client
+}
+
+start_pre() {
+       if [ ! -f /etc/ntp.conf ] ; then
+       eerror "Please create /etc/ntp.conf"
+               return 1
+       fi
+       return 0
+}

diff --git a/net-misc/ntpsec/files/ntpd.service 
b/net-misc/ntpsec/files/ntpd.service
new file mode 100644
index 00000000000..a551bb7b130
--- /dev/null
+++ b/net-misc/ntpsec/files/ntpd.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Network Time Service
+After=network.target nss-lookup.target
+Conflicts=systemd-timesyncd.service
+
+[Service]
+Type=forking
+PrivateTmp=true
+EnvironmentFile=-/etc/conf.d/ntp
+ExecStart=/usr/sbin/ntpd ${NTPD_OPTS}
+Restart=always
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-misc/ntpsec/metadata.xml b/net-misc/ntpsec/metadata.xml
new file mode 100644
index 00000000000..cc6f94e3b23
--- /dev/null
+++ b/net-misc/ntpsec/metadata.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="person">
+<email>anthony.g.b...@gmail.com</email>
+<name>Anthony G. Basile</name>
+</maintainer>
+<longdescription lang="en">
+</longdescription>
+<use>
+    <flag name="early">Drop root privileges early</flag>
+    <flag name="gdb">Enable debugging with gdb</flag>
+    <flag name="nist">Enable lockclock</flag>
+    <flag name="ntpviz">Make visualizations of offsets, jiffies, etc.</flag>
+    <flag name="rclock_oncore">Oncore driver</flag>
+    <flag name="rclock_trimble">Trimble driver</flag>
+    <flag name="rclock_truetime">Trutime driver (deprecated)</flag>
+    <flag name="rclock_gpsd">Enable gpsd daemon support</flag>
+    <flag name="rclock_jjy">JJY driver</flag>
+    <flag name="rclock_generic">Enable support for generic time radios and 
GPSDOs</flag>
+    <flag name="rclock_spectracom">Spectracom driver</flag>
+    <flag name="rclock_shm">Obtain refclock info from shared 
memory-segment</flag>
+    <flag name="rclock_pps">PPS cesium clock driver</flag>
+    <flag name="rclock_hpgps">Hewlett Packard GPS driver</flag>
+    <flag name="rclock_zyfer">Zyfer driver</flag>
+    <flag name="rclock_arbiter">Arbiter 1088A/B GPS driver</flag>
+    <flag name="rclock_nmea">NMEA GPS driver</flag>
+    <flag name="rclock_neoclock">NeoClock4X DCF77/TDF driver</flag>
+    <flag name="rclock_modem">NIST/USNO/PTB Modem Time Services</flag>
+    <flag name="rclock_local">Support for undisciplined local clock (not 
recommended)</flag>
+    <flag name="smear">Specify the interval over which a leap second is 
applied (experimental)</flag>
+    <flag name="tests">Enable tests</flag>
+</use>
+</pkgmetadata>

diff --git a/net-misc/ntpsec/ntpsec-1.0.0.ebuild 
b/net-misc/ntpsec/ntpsec-1.0.0.ebuild
new file mode 100644
index 00000000000..d4cca435dbb
--- /dev/null
+++ b/net-misc/ntpsec/ntpsec-1.0.0.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{4,5,6} )
+PYTHON_REQ_USE='threads(+)'
+
+inherit flag-o-matic python-any-r1 waf-utils systemd user
+
+if [[ ${PV} == *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://gitlab.com/NTPsec/ntpsec.git";
+       BDEPEND=""
+       KEYWORDS=""
+else
+       SRC_URI="ftp://ftp.ntpsec.org/pub/releases/${PN}-${PV}.tar.gz";
+       RESTRICT="mirror"
+       BDEPEND=""
+       KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+fi
+
+DESCRIPTION="The NTP reference implementation, refactored"
+HOMEPAGE="https://www.ntpsec.org/";
+
+NTPSEC_REFCLOCK=(
+       oncore trimble truetime gpsd jjy generic spectracom
+       shm pps hpgps zyfer arbiter nmea neoclock modem
+       local)
+
+IUSE_NTPSEC_REFCLOCK=${NTPSEC_REFCLOCK[@]/#/rclock_}
+
+LICENSE="HPND MIT BSD-2 BSD CC-BY-SA-4.0"
+SLOT="0"
+IUSE="${IUSE_NTPSEC_REFCLOCK} debug doc early gdb nist ntpviz samba seccomp 
smear tests" #ionice
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+# net-misc/pps-tools oncore,pps
+CDEPEND="${PYTHON_DEPS}
+       ${BDEPEND}
+       sys-libs/libcap
+       dev-python/psutil
+       dev-libs/openssl:*
+       seccomp? ( sys-libs/libseccomp )
+"
+RDEPEND="${CDEPEND}
+       ntpviz? ( sci-visualization/gnuplot media-fonts/liberation-fonts )
+"
+DEPEND="${CDEPEND}
+       app-text/asciidoc
+       app-text/docbook-xsl-stylesheets
+       sys-devel/bison
+       rclock_oncore? ( net-misc/pps-tools )
+       rclock_pps? ( net-misc/pps-tools )
+       !net-misc/ntp
+       !net-misc/openntpd
+"
+
+pkg_setup() {
+       python-any-r1_pkg_setup
+       enewgroup ntp 123
+       enewuser ntp 123 -1 /dev/null ntp
+}
+
+src_configure() {
+       is-flagq -flto* && filter-flags -flto* -fuse-linker-plugin
+
+       local string_127=""
+       local rclocks="";
+       local CLOCKSTRING=""
+       for refclock in ${NTPSEC_REFCLOCK[@]} ; do
+               if use  rclock_${refclock} ; then
+                       string_127+="$refclock,"
+               fi
+       done
+       CLOCKSTRING="`echo ${string_127}|sed 's|,$||'`"
+       waf-utils_src_configure --nopyc --nopyo --refclock="${CLOCKSTRING}" \
+               $(use   doc             && echo "--enable-doc") \
+               $(use   early           && echo "--enable-early-droproot") \
+               $(use   gdb             && echo "--enable-debug-gdb") \
+               $(use   nist            && echo "--enable-lockclock") \
+               $(use   samba           && echo "--enable-mssntp") \
+               $(use   seccomp         && echo "--enable-seccomp") \
+               $(use   smear           && echo "--enable-leap-smear") \
+               $(use   tests           && echo "--alltests") \
+               $(use_enable debug debug)
+}
+
+src_install() {
+       waf-utils_src_install
+       mv -v "${ED}/usr/"{,share/}man
+       dosbin  "${S}/contrib/ntpheat"{,usb}
+       dodoc   "${S}/contrib/logrotate-ntpd"
+       systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service
+       newinitd "${FILESDIR}/ntpd.rc-r1" "ntp"
+       newconfd "${FILESDIR}/ntpd.confd" "ntp"
+       mkdir "${ED}/etc/systemd/system/"
+       cp -v "${FILESDIR}/ntpd.service" "${ED}/etc/systemd/system/"
+       # ntpd.confd  ntpd.rc-r1  ntpd.service
+
+       mkdir -pv "${ED}/etc/"{logrotate,ntp-conf}.d
+       cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd"
+       cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/"
+       mv -v "${ED}/etc/ntp.d/example.conf" "${ED}/etc/ntp.conf"
+       sed "s|includefile |includefile ntp-conf.d/|" -i "${ED}/etc/ntp.conf"
+}

Reply via email to