From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1C51C13835B for ; Tue, 26 Jan 2021 18:17:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 187D6E0CBF; Tue, 26 Jan 2021 18:17:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C6A5CE0CBD for ; Tue, 26 Jan 2021 18:17:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 81E49340E5F for ; Tue, 26 Jan 2021 18:17:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7D9A04AD for ; Tue, 26 Jan 2021 18:17:32 +0000 (UTC) From: "Quentin Retornaz" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Quentin Retornaz" Message-ID: <1611620503.f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab.quentin@gentoo> Subject: [gentoo-commits] repo/proj/libressl:master commit in: net-misc/ntp/files/man-pages/, net-misc/ntp/files/, net-misc/ntp/ X-VCS-Repository: repo/proj/libressl X-VCS-Files: net-misc/ntp/Manifest net-misc/ntp/files/man-pages/genmans.sh net-misc/ntp/files/man-pages/ntp.conf.5.patch net-misc/ntp/files/man-pages/ntp.xsl net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch net-misc/ntp/files/ntp-client.confd net-misc/ntp/files/ntp-client.rc net-misc/ntp/files/ntp.conf net-misc/ntp/files/ntpd.confd net-misc/ntp/files/ntpd.rc-r1 net-misc/ntp/files/ntpd.service-r2 net-misc/ntp/files/ntpdate.service-r2 net-misc/ntp/files/ntpdate.service.conf net-misc/ntp/files/sntp.confd net-misc/ntp/files/sntp.rc net-misc/ntp/files/sntp.service-r3 net-misc/ntp/files/sntp.service.conf net-misc/ntp/metadata.xml net-misc/ntp/ntp-4.2.8_p15.ebuild X-VCS-Directories: net-misc/ntp/files/man-pages/ net-misc/ntp/files/ net-misc/ntp/ X-VCS-Committer: quentin X-VCS-Committer-Name: Quentin Retornaz X-VCS-Revision: f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab X-VCS-Branch: master Date: Tue, 26 Jan 2021 18:17:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8283c90c-2e05-46f6-9ba3-aa28f1c630c8 X-Archives-Hash: 2c53dcc7cdb40f5ca23d088ddd9fb097 commit: f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab Author: Quentin Retornaz retornaz com> AuthorDate: Sun Jan 17 19:39:29 2021 +0000 Commit: Quentin Retornaz retornaz com> CommitDate: Tue Jan 26 00:21:43 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=f02c7e92 net-misc/ntp: new package Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Quentin Retornaz retornaz.com> net-misc/ntp/Manifest | 2 + net-misc/ntp/files/man-pages/genmans.sh | 75 +++++++ net-misc/ntp/files/man-pages/ntp.conf.5.patch | 27 +++ net-misc/ntp/files/man-pages/ntp.xsl | 218 +++++++++++++++++++++ net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch | 16 ++ .../ntp/files/ntp-4.2.8-sntp-test-pthreads.patch | 13 ++ ...tp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch | 39 ++++ .../ntp/files/ntp-4.2.8_p12-libressl-2.8.patch | 16 ++ .../ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch | 13 ++ net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch | 75 +++++++ net-misc/ntp/files/ntp-client.confd | 21 ++ net-misc/ntp/files/ntp-client.rc | 31 +++ net-misc/ntp/files/ntp.conf | 54 +++++ net-misc/ntp/files/ntpd.confd | 6 + net-misc/ntp/files/ntpd.rc-r1 | 22 +++ net-misc/ntp/files/ntpd.service-r2 | 11 ++ net-misc/ntp/files/ntpdate.service-r2 | 14 ++ net-misc/ntp/files/ntpdate.service.conf | 2 + net-misc/ntp/files/sntp.confd | 4 + net-misc/ntp/files/sntp.rc | 26 +++ net-misc/ntp/files/sntp.service-r3 | 14 ++ net-misc/ntp/files/sntp.service.conf | 2 + net-misc/ntp/metadata.xml | 23 +++ net-misc/ntp/ntp-4.2.8_p15.ebuild | 145 ++++++++++++++ 24 files changed, 869 insertions(+) diff --git a/net-misc/ntp/Manifest b/net-misc/ntp/Manifest new file mode 100644 index 0000000..c618253 --- /dev/null +++ b/net-misc/ntp/Manifest @@ -0,0 +1,2 @@ +DIST ntp-4.2.8p15-manpages.tar.xz 25700 BLAKE2B 6a225bc19dcebee31cb8e0d621963863d567a882655b57be8b65a16f9d3dd138787c7c6b9ff08853306f2e9b11d65cb76e3215cc5b2262a91c411d437974fc18 SHA512 21721550864b4e7e91bf20ca894109253439b737799dfc803e1496b3454199f34646f40e0156c08a39d5914e5a92f35908cec0245e1e2627c75c0e64939ba028 +DIST ntp-4.2.8p15.tar.gz 7015970 BLAKE2B 5697d6623d79686f9ca9ad907172bf942383067d1e9817117d20db042e9f7410644f236f1a0d77ab6bf6ec468476e12ea65b494a28f0dd8674bf08fc8875cfef SHA512 f5ad765e45fc302263dd40e94c287698fd235b94f3684e49f1d5d09d7d8bdd6b8c0fb96ecdabffea3d233e1e79b3c9687b76dc204ba76bad3f554682f4a97794 diff --git a/net-misc/ntp/files/man-pages/genmans.sh b/net-misc/ntp/files/man-pages/genmans.sh new file mode 100755 index 0000000..bae21e2 --- /dev/null +++ b/net-misc/ntp/files/man-pages/genmans.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# ntpman.sh -- Create man pages for ntp +# + +VERSION=$1 +if [[ -z ${VERSION} ]] ; then + VERSION=$(ls -1d ntp-*/ 2>/dev/null | LC_COLLATE=C sort | sed -n '${s:/::;p;Q}') + if [[ -z ${VERSION} ]] ; then + VERSION=$(ls "${0%/*}"/../../ntp-*.ebuild | LC_COLLATE=C sort | sed -n '${s:.*/::;s:_::;s:[.]ebuild::;p;Q}') + if [[ -z ${VERSION} ]] ; then + echo "Usage: $0 " + exit 1 + fi + fi +fi +[[ ${VERSION} != ntp-* ]] && VERSION="ntp-${VERSION}" + +SRCDIR=${0%/*} +HTMLDIR=${SRCDIR}/${VERSION}/html +DISTFILE=/usr/portage/distfiles/${VERSION}.tar.gz +MANDIR=${SRCDIR}/man + +rm -rf ${SRCDIR}/${VERSION} +if [[ ! -d ${HTMLDIR} ]] ; then + if [[ -f ${DISTFILE} ]] ; then + tar zxf ${DISTFILE} -C ${SRCDIR} || exit 1 + else + echo "ERROR: $HTMLDIR / $DISTFILE does not exist" + exit 1 + fi +fi + +# Process a single HTML file +processfile() { + HTMLFILE=$1 + MANFILE=$2 + echo -n "Processing $HTMLFILE ..." + sed -e "s:/:" $HTMLDIR/$HTMLFILE > .$HTMLFILE + xsltproc --html --stringparam version $VERSION ${SRCDIR}/ntp.xsl .$HTMLFILE > $MANDIR/$MANFILE || exit 1 + rm -f .$HTMLFILE + echo "Done." +} + +# Print information +echo "Generates ntp man files from HTML documentation. Using:" +echo "VERSION: $VERSION" +echo "HTMLDIR: $HTMLDIR" +echo "MANDIR: $MANDIR" +echo "Press enter to continue, or Ctrl-C to cancel." +read + +# Process HTML files +rm -rf ${MANDIR} +mkdir ${MANDIR} +for f in ntp{date,dc,d,q,time,trace,dsim} keygen tickadj ; do + processfile ${f}.html ${f}.8 +done +echo + +cp -vi /usr/local/src/freebsd/src/usr.sbin/ntp/doc/*.5 ${MANDIR} +( +d=${PWD} +cd ${MANDIR} +shopt -s nullglob +for p in $d/*.5.patch ; do + patch -F0 -p0 < $p || exit 1 +done +) || exit 1 +cp -vi ${SRCDIR}/*.patch ${SRCDIR}/genmans.sh ${SRCDIR}/ntp.xsl ${MANDIR} + +tar -jcf ${VERSION}-manpages.tar.bz2 -C ${MANDIR}/.. man +du -b ${VERSION}-manpages.tar.bz2 + +rm -rf ${MANDIR} ${SRCDIR}/${VERSION} diff --git a/net-misc/ntp/files/man-pages/ntp.conf.5.patch b/net-misc/ntp/files/man-pages/ntp.conf.5.patch new file mode 100644 index 0000000..c3d8123 --- /dev/null +++ b/net-misc/ntp/files/man-pages/ntp.conf.5.patch @@ -0,0 +1,27 @@ +--- ntp.conf.5 ++++ ntp.conf.5 +@@ -24,16 +24,6 @@ + .Fl c + command line option). + .Pp +-The +-.Pa /etc/rc.d/ntpdate +-script reads this file to get a list of NTP servers to use if the +-variable +-.Dq Li ntpdate_hosts +-was not declared. +-Refer to the +-.Xr rc.conf 5 +-man page for further info about this. +-.Pp + The file format is similar to other + .Ux + configuration files. +@@ -2686,7 +2676,6 @@ + Diffie-Hellman agreement parameters + .El + .Sh SEE ALSO +-.Xr rc.conf 5 , + .Xr ntpd 8 , + .Xr ntpdc 8 , + .Xr ntpq 8 diff --git a/net-misc/ntp/files/man-pages/ntp.xsl b/net-misc/ntp/files/man-pages/ntp.xsl new file mode 100644 index 0000000..ed9c1f8 --- /dev/null +++ b/net-misc/ntp/files/man-pages/ntp.xsl @@ -0,0 +1,218 @@ + + + + + +]> + + + + + + + + + + + + + + + + .\" Automatically generated from HTML source. + DO NOT EDIT!&newline; + + + + + .TH + + 1 "" "ntp + + " + &newline; + .SH NAME + &newline; + + &newline; + + + + + + + + + + + + + + + + + &newline; + + .SH + + &newline; + + + + .SH AUTHOR + &newline; + + + + + + + + + &newline; + + .P + &newline; + + &newline; + + + + &newline; + &newline; + + + + + + + + &newline; + .ft CW + &newline; + .nf + &newline; + + + + &newline; + .ft R + &newline; + .fi + &newline; + + + + + + + + + + + + + + + + + .TP&newline; + .B + + &newline; + + + + + &newline; + + + + + + &newline; + &newline; + + + + + &newline; + \fB + + \fR + + + + &newline; + \fI + + \fR + + + + + + + + + + &newline; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch b/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch new file mode 100644 index 0000000..a1e5580 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch @@ -0,0 +1,16 @@ +http://bugs.ntp.org/show_bug.cgi?id=2646 +https://bugs.gentoo.org/533966 + +--- a/ntpd/ntpd.c ++++ a/ntpd/ntpd.c +@@ -971,8 +971,8 @@ getgroup: + char *captext; + + captext = (0 != interface_interval) +- ? "cap_sys_time,cap_net_bind_service=pe" +- : "cap_sys_time=pe"; ++ ? "cap_ipc_lock,cap_sys_time,cap_net_bind_service=pe" ++ : "cap_ipc_lock,cap_sys_time=pe"; + caps = cap_from_text(captext); + if (!caps) { + msyslog(LOG_ERR, diff --git a/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch b/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch new file mode 100644 index 0000000..4f8d15f --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/563922 +http://bugs.ntp.org/show_bug.cgi?id=2906 + +--- a/sntp/tests/Makefile.in ++++ b/sntp/tests/Makefile.in +@@ -783,6 +783,7 @@ base_LDADD = \ + $(LIBOPTS_LDADD) \ + $(LDADD_LIBEVENT) \ + $(top_builddir)/../libntp/libntp.a \ ++ $(PTHREAD_LIBS) \ + $(LDADD_LIBNTP) \ + $(LDADD_NTP) \ + $(NULL) diff --git a/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch new file mode 100644 index 0000000..1b532c6 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch @@ -0,0 +1,39 @@ +Fix building with libressl or without SSL. + +Origin: http://bugs.ntp.org/attachment.cgi?id=1481 + +LibreSSL fix from Joe Kappus (https://bugs.gentoo.org/show_bug.cgi?id=600668#c2) + +--- a/include/libssl_compat.h ++++ b/include/libssl_compat.h +@@ -37,7 +37,7 @@ + #endif + + /* ----------------------------------------------------------------- */ +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + /* ----------------------------------------------------------------- */ + + # include +--- a/libntp/libssl_compat.c ++++ b/libntp/libssl_compat.c +@@ -26,7 +26,7 @@ + /* ----------------------------------------------------------------- */ + + /* ----------------------------------------------------------------- */ +-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(OPENSSL) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) + /* ----------------------------------------------------------------- */ + + #include "libssl_compat.h" +--- a/libntp/ssl_init.c ++++ b/libntp/ssl_init.c +@@ -21,7 +21,7 @@ + + int ssl_init_done; + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + static void + atexit_ssl_cleanup(void) diff --git a/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch b/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch new file mode 100644 index 0000000..182fcef --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch @@ -0,0 +1,16 @@ +--- ntp-4.2.8p12.orig/include/libssl_compat.h 2018-12-08 01:14:58.434733497 +0000 ++++ ntp-4.2.8p12/include/libssl_compat.h 2018-12-08 01:42:04.479474757 +0000 +@@ -107,10 +107,13 @@ + + #define OpenSSL_version_num SSLeay + #define OpenSSL_version SSLeay_version ++ ++# if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L + #define X509_get0_notBefore X509_get_notBefore + #define X509_getm_notBefore X509_get_notBefore + #define X509_get0_notAfter X509_get_notAfter + #define X509_getm_notAfter X509_get_notAfter ++#endif /* !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L */ + + /* ----------------------------------------------------------------- */ + #endif /* OPENSSL_VERSION_NUMBER < v1.1.0 */ diff --git a/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch b/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch new file mode 100644 index 0000000..183b6d8 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/711530 + +--- ntp-4.2.8p14/ntpd/ntpd.c ++++ ntp-4.2.8p14/ntpd/ntpd.c +@@ -1189,7 +1189,7 @@ + * drop privileges in this case. + */ + cap_t caps; +- caps = cap_from_text("cap_sys_time,cap_setuid,cap_setgid,cap_sys_chroot,cap_net_bind_service=pe"); ++ caps = cap_from_text("cap_ipc_lock,cap_sys_time,cap_setuid,cap_setgid,cap_sys_chroot,cap_net_bind_service=pe"); + if ( ! caps) { + msyslog( LOG_ERR, "cap_from_text() failed: %m" ); + exit(-1); diff --git a/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch b/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch new file mode 100644 index 0000000..619ea07 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch @@ -0,0 +1,75 @@ + +Source: +https://bugs.ntp.org/show_bug.cgi?id=3688 + +Juergen Perlinger 2020-12-24 07:10:49 UTC +Created attachment 1760 [details] +ultimate patch, v00 + +--- a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100 ++++ a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100 +@@ -2,7 +2,7 @@ + + #include "log.h" + +-const char *progname; /* for msyslog use too */ ++extern const char *progname; /* for msyslog use too */ + + static int counter = 0; + +--- a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100 +@@ -20,7 +20,6 @@ + #include "log.h" + #include "libntp.h" + +- + int shutting_down; + int time_derived; + int time_adjusted; +--- a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100 +@@ -16,6 +16,14 @@ + + #include "crypto.h" + ++/* !Attention! 'progname' must de instantiated in any program that wants ++ * to use this library. Putting it into the library breaks a lot of ++ * things, since many programs define it itself and then the symbol ++ * might end up twice in the linker. ++ */ ++extern const char * progname; ++ ++ + void set_li_vn_mode(struct pkt *spkt, char leap, char version, char mode); + extern int sntp_main(int argc, char **argv, const char *); + int generate_pkt(struct pkt *x_pkt, const struct timeval *tv_xmt, +--- a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100 +@@ -2,6 +2,8 @@ + + #include "main.h" + ++const char * progname; ++ + int + main ( + int argc, +--- a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100 +@@ -3,7 +3,6 @@ + #include "ntp_types.h" + + +-//#include "log.h" + #include "log.c" + + void setUp(void); +--- a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100 ++++ a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100 +@@ -5,4 +5,4 @@ + + time_t timefunc(time_t *ptr); + void settime(int y, int m, int d, int H, int M, int S); +-time_t nowtime; ++extern time_t nowtime; diff --git a/net-misc/ntp/files/ntp-client.confd b/net-misc/ntp/files/ntp-client.confd new file mode 100644 index 0000000..786004d --- /dev/null +++ b/net-misc/ntp/files/ntp-client.confd @@ -0,0 +1,21 @@ +# /etc/conf.d/ntp-client + +# Command to run to set the clock initially +# Most people should just leave this line alone ... +# however, if you know what you're doing, and you +# want to use ntpd to set the clock, change this to 'ntpd' +NTPCLIENT_CMD="ntpdate" + +# Options to pass to the above command +# This default setting should work fine but you should +# change the default 'pool.ntp.org' to something closer +# to your machine. See http://www.pool.ntp.org/ or +# try running `netselect -s 3 pool.ntp.org`. +NTPCLIENT_OPTS="-s -b -u \ + 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \ + 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" + +# If you use hostnames above, then you should depend on dns +# being up & running before we try to run. Otherwise, you +# can disable this. +rc_use="dns" diff --git a/net-misc/ntp/files/ntp-client.rc b/net-misc/ntp/files/ntp-client.rc new file mode 100644 index 0000000..b3e3a81 --- /dev/null +++ b/net-misc/ntp/files/ntp-client.rc @@ -0,0 +1,31 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before cron portmap + after net + use dns logger +} + +checkconfig() { + if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "Unable to locate the client command ${NTPCLIENT_CMD}!" + return 1 + fi + if [ -z "${NTPCLIENT_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + checkconfig || return $? + + ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'" + "${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/ntp.conf b/net-misc/ntp/files/ntp.conf new file mode 100644 index 0000000..97bed8d --- /dev/null +++ b/net-misc/ntp/files/ntp.conf @@ -0,0 +1,54 @@ +# NOTES: +# DHCP clients can append or replace NTP configuration files. +# You should consult your DHCP client documentation about its +# default behaviour and how to change it. + +# Name of the servers ntpd should sync with +# Please respect the access policy as stated by the responsible person. +#server ntp.example.tld iburst + +# Common pool for random people +#server pool.ntp.org + +# Pools for Gentoo users +server 0.gentoo.pool.ntp.org +server 1.gentoo.pool.ntp.org +server 2.gentoo.pool.ntp.org +server 3.gentoo.pool.ntp.org + +## +# A list of available servers can be found here: +# http://www.pool.ntp.org/ +# http://www.pool.ntp.org/#use +# A good way to get servers for your machine is: +# netselect -s 3 pool.ntp.org +## + +# you should not need to modify the following paths +driftfile /var/lib/ntp/ntp.drift + +#server ntplocal.example.com prefer +#server timeserver.example.org + +# Warning: Using default NTP settings will leave your NTP +# server accessible to all hosts on the Internet. + +# If you want to deny all machines (including your own) +# from accessing the NTP server, uncomment: +#restrict default ignore + + +# Default configuration: +# - Allow only time queries, at a limited rate, sending KoD when in excess. +# - Allow all local queries (IPv4, IPv6) +restrict default nomodify nopeer noquery limited kod +restrict 127.0.0.1 +restrict [::1] + + +# To allow machines within your network to synchronize +# their clocks with your server, but ensure they are +# not allowed to configure the server or used as peers +# to synchronize against, uncomment this line. +# +#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap diff --git a/net-misc/ntp/files/ntpd.confd b/net-misc/ntp/files/ntpd.confd new file mode 100644 index 0000000..2b74282 --- /dev/null +++ b/net-misc/ntp/files/ntpd.confd @@ -0,0 +1,6 @@ +# /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 -u ntp:ntp" diff --git a/net-misc/ntp/files/ntpd.rc-r1 b/net-misc/ntp/files/ntpd.rc-r1 new file mode 100644 index 0000000..e6e7aa1 --- /dev/null +++ b/net-misc/ntp/files/ntpd.rc-r1 @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +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/ntp/files/ntpd.service-r2 b/net-misc/ntp/files/ntpd.service-r2 new file mode 100644 index 0000000..5f11b27 --- /dev/null +++ b/net-misc/ntp/files/ntpd.service-r2 @@ -0,0 +1,11 @@ +[Unit] +Description=Network Time Service +After=ntpdate.service sntp.service +Conflicts=systemd-timesyncd.service + +[Service] +ExecStart=/usr/sbin/ntpd -g -n +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/ntpdate.service-r2 b/net-misc/ntp/files/ntpdate.service-r2 new file mode 100644 index 0000000..7ad294e --- /dev/null +++ b/net-misc/ntp/files/ntpdate.service-r2 @@ -0,0 +1,14 @@ +[Unit] +Description=Set time via NTP using ntpdate +After=network-online.target nss-lookup.target +Before=time-sync.target +Wants=network-online.target time-sync.target +Conflicts=systemd-timesyncd.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/ntpdate -b -u $SERVER +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/ntpdate.service.conf b/net-misc/ntp/files/ntpdate.service.conf new file mode 100644 index 0000000..75e4f41 --- /dev/null +++ b/net-misc/ntp/files/ntpdate.service.conf @@ -0,0 +1,2 @@ +[Service] +Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/files/sntp.confd b/net-misc/ntp/files/sntp.confd new file mode 100644 index 0000000..d11983a --- /dev/null +++ b/net-misc/ntp/files/sntp.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/sntp + +# Options to pass to sntp +SNTP_OPTS="-s 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/files/sntp.rc b/net-misc/ntp/files/sntp.rc new file mode 100644 index 0000000..cbe9911 --- /dev/null +++ b/net-misc/ntp/files/sntp.rc @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/sntp" + +depend() { + before cron portmap + after net + use dns logger +} + +start_pre() { + if [ -z "${SNTP_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/sntp" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + ebegin "Setting clock via SNTP" + ${command} ${SNTP_OPTS} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/sntp.service-r3 b/net-misc/ntp/files/sntp.service-r3 new file mode 100644 index 0000000..2ab722f --- /dev/null +++ b/net-misc/ntp/files/sntp.service-r3 @@ -0,0 +1,14 @@ +[Unit] +Description=Set time via SNTP +After=network.target network-online.target nss-lookup.target +Before=time-sync.target +Wants=network-online.target time-sync.target +Conflicts=systemd-timesyncd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/sntp -s $SERVER +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/sntp.service.conf b/net-misc/ntp/files/sntp.service.conf new file mode 100644 index 0000000..75e4f41 --- /dev/null +++ b/net-misc/ntp/files/sntp.service.conf @@ -0,0 +1,2 @@ +[Service] +Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/metadata.xml b/net-misc/ntp/metadata.xml new file mode 100644 index 0000000..88e81f1 --- /dev/null +++ b/net-misc/ntp/metadata.xml @@ -0,0 +1,23 @@ + + + + + base-system@gentoo.org + Gentoo Base System + + +NTP is a protocol designed to synchronize the clocks of computers over a network. NTP +version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a +significant revision of the NTP standard, and is the current development version, but +has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC +2030. + + + Allow ntp to be installed alongside openntpd + Add support for PARSE clocks + Provide support for Samba's signing daemon (needed for Active Directory domain controllers) + + + cpe:/a:ntp:ntp + + diff --git a/net-misc/ntp/ntp-4.2.8_p15.ebuild b/net-misc/ntp/ntp-4.2.8_p15.ebuild new file mode 100644 index 0000000..1405367 --- /dev/null +++ b/net-misc/ntp/ntp-4.2.8_p15.ebuild @@ -0,0 +1,145 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools toolchain-funcs flag-o-matic systemd + +MY_P=${P/_p/p} +DESCRIPTION="Network Time Protocol suite/programs" +HOMEPAGE="http://www.ntp.org/" +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz + https://dev.gentoo.org/~polynomial-c/${MY_P}-manpages.tar.xz" + +LICENSE="HPND BSD ISC" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux" +IUSE="caps debug ipv6 libressl openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf" + +COMMON_DEPEND="readline? ( >=sys-libs/readline-4.1:0= ) + >=dev-libs/libevent-2.0.9:=[threads?] + kernel_linux? ( caps? ( sys-libs/libcap ) ) + zeroconf? ( net-dns/avahi[mdnsresponder-compat] ) + snmp? ( net-analyzer/net-snmp ) + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + parse-clocks? ( net-misc/pps-tools )" +BDEPEND="virtual/pkgconfig + acct-group/ntp + acct-user/ntp" +DEPEND="${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND} + acct-group/ntp + acct-user/ntp + selinux? ( sec-policy/selinux-ntp ) + vim-syntax? ( app-vim/ntp-syntax ) + !net-misc/ntpsec + !openntpd? ( !net-misc/openntpd ) +" +PDEPEND="openntpd? ( net-misc/openntpd )" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966 + "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922 + "${FILESDIR}"/${PN}-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch + "${FILESDIR}"/${PN}-4.2.8_p12-libressl-2.8.patch + "${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch #711530 + "${FILESDIR}"/${PN}-4.2.8_p15-gcc10.patch #759409 +) + +src_prepare() { + default + append-cppflags -D_GNU_SOURCE #264109 + # Make sure every build uses the same install layout. #539092 + find sntp/loc/ -type f '!' -name legacy -delete || die + eautoreconf #622754 + # Disable pointless checks. + touch .checkChangeLog .gcc-warning FRC.html html/.datecheck +} + +src_configure() { + # avoid libmd5/libelf + export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no + export ac_cv_lib_elf_nlist=no + # blah, no real configure options #176333 + export ac_cv_header_dns_sd_h=$(usex zeroconf) + export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h} + local myeconfargs=( + --with-lineeditlibs=readline,edit,editline + --with-yielding-select + --disable-local-libevent + # Increase the default memlimit from 32MiB to 128MiB. #533232 + --with-memlock=256 + $(use_enable caps linuxcaps) + $(use_enable parse-clocks) + $(use_enable ipv6) + $(use_enable debug debugging) + $(use_with readline lineeditlibs readline) + $(use_enable samba ntp-signd) + $(use_with snmp ntpsnmpd) + $(use_with ssl crypto) + $(use_enable threads thread-support) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + # move ntpd/ntpdate to sbin #66671 + dodir /usr/sbin + mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin" + + dodoc INSTALL WHERE-TO-START + doman "${WORKDIR}"/man/*.[58] + + insinto /etc + doins "${FILESDIR}"/ntp.conf + use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf #524726 + newinitd "${FILESDIR}"/ntpd.rc-r1 ntpd + newconfd "${FILESDIR}"/ntpd.confd ntpd + newinitd "${FILESDIR}"/ntp-client.rc ntp-client + newconfd "${FILESDIR}"/ntp-client.confd ntp-client + newinitd "${FILESDIR}"/sntp.rc sntp + newconfd "${FILESDIR}"/sntp.confd sntp + if ! use caps ; then + sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die + fi + sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die + + keepdir /var/lib/ntp + use prefix || fowners ntp:ntp /var/lib/ntp + + if use openntpd ; then + cd "${ED}" || die + rm usr/sbin/ntpd || die + rm -r var/lib || die + rm etc/{conf,init}.d/ntpd || die + rm usr/share/man/*/ntpd.8 || die + else + systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service + if use caps ; then + sed -i '/ExecStart/ s|$| -u ntp:ntp|' \ + "${D}$(systemd_get_systemunitdir)"/ntpd.service \ + || die + fi + systemd_enable_ntpunit 60-ntpd ntpd.service + fi + + systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service + systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf + systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service + systemd_install_serviced "${FILESDIR}"/sntp.service.conf +} + +pkg_postinst() { + if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then + eerror "The notrust option was found in your /etc/ntp.conf!" + ewarn "If your ntpd starts sending out weird responses," + ewarn "then make sure you have keys properly setup and see" + ewarn "https://bugs.gentoo.org/41827" + fi +} From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 81E2E1382C5 for ; Tue, 26 Jan 2021 00:39:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EEDFEE0C27; Tue, 26 Jan 2021 00:22:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C1A44E0C22 for ; Tue, 26 Jan 2021 00:22:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7BA5B341252 for ; Tue, 26 Jan 2021 00:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5A54C4AD for ; Tue, 26 Jan 2021 00:22:51 +0000 (UTC) From: "Quentin Retornaz" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Quentin Retornaz" Message-ID: <1611620503.f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab.quentin@gentoo> Subject: [gentoo-commits] repo/proj/libressl:migration commit in: net-misc/ntp/files/man-pages/, net-misc/ntp/files/, net-misc/ntp/ X-VCS-Repository: repo/proj/libressl X-VCS-Files: net-misc/ntp/Manifest net-misc/ntp/files/man-pages/genmans.sh net-misc/ntp/files/man-pages/ntp.conf.5.patch net-misc/ntp/files/man-pages/ntp.xsl net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch net-misc/ntp/files/ntp-client.confd net-misc/ntp/files/ntp-client.rc net-misc/ntp/files/ntp.conf net-misc/ntp/files/ntpd.confd net-misc/ntp/files/ntpd.rc-r1 net-misc/ntp/files/ntpd.service-r2 net-misc/ntp/files/ntpdate.service-r2 net-misc/ntp/files/ntpdate.service.conf net-misc/ntp/files/sntp.confd net-misc/ntp/files/sntp.rc net-misc/ntp/files/sntp.service-r3 net-misc/ntp/files/sntp.service.conf net-misc/ntp/metadata.xml net-misc/ntp/ntp-4.2.8_p15.ebuild X-VCS-Directories: net-misc/ntp/ net-misc/ntp/files/ net-misc/ntp/files/man-pages/ X-VCS-Committer: quentin X-VCS-Committer-Name: Quentin Retornaz X-VCS-Revision: f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab X-VCS-Branch: migration Date: Tue, 26 Jan 2021 00:22:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 91e21500-eee5-481b-95c8-aad837915b94 X-Archives-Hash: 2a2f07345a11ec53a460a7e9e57413ca Message-ID: <20210126002251.BN0NYvgskNV16CDTt1vvamQoaedQiiGClMLp2b1fZsk@z> commit: f02c7e92cd62f3911d82f0e6fb5f17a5db0317ab Author: Quentin Retornaz retornaz com> AuthorDate: Sun Jan 17 19:39:29 2021 +0000 Commit: Quentin Retornaz retornaz com> CommitDate: Tue Jan 26 00:21:43 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=f02c7e92 net-misc/ntp: new package Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Quentin Retornaz retornaz.com> net-misc/ntp/Manifest | 2 + net-misc/ntp/files/man-pages/genmans.sh | 75 +++++++ net-misc/ntp/files/man-pages/ntp.conf.5.patch | 27 +++ net-misc/ntp/files/man-pages/ntp.xsl | 218 +++++++++++++++++++++ net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch | 16 ++ .../ntp/files/ntp-4.2.8-sntp-test-pthreads.patch | 13 ++ ...tp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch | 39 ++++ .../ntp/files/ntp-4.2.8_p12-libressl-2.8.patch | 16 ++ .../ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch | 13 ++ net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch | 75 +++++++ net-misc/ntp/files/ntp-client.confd | 21 ++ net-misc/ntp/files/ntp-client.rc | 31 +++ net-misc/ntp/files/ntp.conf | 54 +++++ net-misc/ntp/files/ntpd.confd | 6 + net-misc/ntp/files/ntpd.rc-r1 | 22 +++ net-misc/ntp/files/ntpd.service-r2 | 11 ++ net-misc/ntp/files/ntpdate.service-r2 | 14 ++ net-misc/ntp/files/ntpdate.service.conf | 2 + net-misc/ntp/files/sntp.confd | 4 + net-misc/ntp/files/sntp.rc | 26 +++ net-misc/ntp/files/sntp.service-r3 | 14 ++ net-misc/ntp/files/sntp.service.conf | 2 + net-misc/ntp/metadata.xml | 23 +++ net-misc/ntp/ntp-4.2.8_p15.ebuild | 145 ++++++++++++++ 24 files changed, 869 insertions(+) diff --git a/net-misc/ntp/Manifest b/net-misc/ntp/Manifest new file mode 100644 index 0000000..c618253 --- /dev/null +++ b/net-misc/ntp/Manifest @@ -0,0 +1,2 @@ +DIST ntp-4.2.8p15-manpages.tar.xz 25700 BLAKE2B 6a225bc19dcebee31cb8e0d621963863d567a882655b57be8b65a16f9d3dd138787c7c6b9ff08853306f2e9b11d65cb76e3215cc5b2262a91c411d437974fc18 SHA512 21721550864b4e7e91bf20ca894109253439b737799dfc803e1496b3454199f34646f40e0156c08a39d5914e5a92f35908cec0245e1e2627c75c0e64939ba028 +DIST ntp-4.2.8p15.tar.gz 7015970 BLAKE2B 5697d6623d79686f9ca9ad907172bf942383067d1e9817117d20db042e9f7410644f236f1a0d77ab6bf6ec468476e12ea65b494a28f0dd8674bf08fc8875cfef SHA512 f5ad765e45fc302263dd40e94c287698fd235b94f3684e49f1d5d09d7d8bdd6b8c0fb96ecdabffea3d233e1e79b3c9687b76dc204ba76bad3f554682f4a97794 diff --git a/net-misc/ntp/files/man-pages/genmans.sh b/net-misc/ntp/files/man-pages/genmans.sh new file mode 100755 index 0000000..bae21e2 --- /dev/null +++ b/net-misc/ntp/files/man-pages/genmans.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# ntpman.sh -- Create man pages for ntp +# + +VERSION=$1 +if [[ -z ${VERSION} ]] ; then + VERSION=$(ls -1d ntp-*/ 2>/dev/null | LC_COLLATE=C sort | sed -n '${s:/::;p;Q}') + if [[ -z ${VERSION} ]] ; then + VERSION=$(ls "${0%/*}"/../../ntp-*.ebuild | LC_COLLATE=C sort | sed -n '${s:.*/::;s:_::;s:[.]ebuild::;p;Q}') + if [[ -z ${VERSION} ]] ; then + echo "Usage: $0 " + exit 1 + fi + fi +fi +[[ ${VERSION} != ntp-* ]] && VERSION="ntp-${VERSION}" + +SRCDIR=${0%/*} +HTMLDIR=${SRCDIR}/${VERSION}/html +DISTFILE=/usr/portage/distfiles/${VERSION}.tar.gz +MANDIR=${SRCDIR}/man + +rm -rf ${SRCDIR}/${VERSION} +if [[ ! -d ${HTMLDIR} ]] ; then + if [[ -f ${DISTFILE} ]] ; then + tar zxf ${DISTFILE} -C ${SRCDIR} || exit 1 + else + echo "ERROR: $HTMLDIR / $DISTFILE does not exist" + exit 1 + fi +fi + +# Process a single HTML file +processfile() { + HTMLFILE=$1 + MANFILE=$2 + echo -n "Processing $HTMLFILE ..." + sed -e "s:/:" $HTMLDIR/$HTMLFILE > .$HTMLFILE + xsltproc --html --stringparam version $VERSION ${SRCDIR}/ntp.xsl .$HTMLFILE > $MANDIR/$MANFILE || exit 1 + rm -f .$HTMLFILE + echo "Done." +} + +# Print information +echo "Generates ntp man files from HTML documentation. Using:" +echo "VERSION: $VERSION" +echo "HTMLDIR: $HTMLDIR" +echo "MANDIR: $MANDIR" +echo "Press enter to continue, or Ctrl-C to cancel." +read + +# Process HTML files +rm -rf ${MANDIR} +mkdir ${MANDIR} +for f in ntp{date,dc,d,q,time,trace,dsim} keygen tickadj ; do + processfile ${f}.html ${f}.8 +done +echo + +cp -vi /usr/local/src/freebsd/src/usr.sbin/ntp/doc/*.5 ${MANDIR} +( +d=${PWD} +cd ${MANDIR} +shopt -s nullglob +for p in $d/*.5.patch ; do + patch -F0 -p0 < $p || exit 1 +done +) || exit 1 +cp -vi ${SRCDIR}/*.patch ${SRCDIR}/genmans.sh ${SRCDIR}/ntp.xsl ${MANDIR} + +tar -jcf ${VERSION}-manpages.tar.bz2 -C ${MANDIR}/.. man +du -b ${VERSION}-manpages.tar.bz2 + +rm -rf ${MANDIR} ${SRCDIR}/${VERSION} diff --git a/net-misc/ntp/files/man-pages/ntp.conf.5.patch b/net-misc/ntp/files/man-pages/ntp.conf.5.patch new file mode 100644 index 0000000..c3d8123 --- /dev/null +++ b/net-misc/ntp/files/man-pages/ntp.conf.5.patch @@ -0,0 +1,27 @@ +--- ntp.conf.5 ++++ ntp.conf.5 +@@ -24,16 +24,6 @@ + .Fl c + command line option). + .Pp +-The +-.Pa /etc/rc.d/ntpdate +-script reads this file to get a list of NTP servers to use if the +-variable +-.Dq Li ntpdate_hosts +-was not declared. +-Refer to the +-.Xr rc.conf 5 +-man page for further info about this. +-.Pp + The file format is similar to other + .Ux + configuration files. +@@ -2686,7 +2676,6 @@ + Diffie-Hellman agreement parameters + .El + .Sh SEE ALSO +-.Xr rc.conf 5 , + .Xr ntpd 8 , + .Xr ntpdc 8 , + .Xr ntpq 8 diff --git a/net-misc/ntp/files/man-pages/ntp.xsl b/net-misc/ntp/files/man-pages/ntp.xsl new file mode 100644 index 0000000..ed9c1f8 --- /dev/null +++ b/net-misc/ntp/files/man-pages/ntp.xsl @@ -0,0 +1,218 @@ + + + + + +]> + + + + + + + + + + + + + + + + .\" Automatically generated from HTML source. + DO NOT EDIT!&newline; + + + + + .TH + + 1 "" "ntp + + " + &newline; + .SH NAME + &newline; + + &newline; + + + + + + + + + + + + + + + + + &newline; + + .SH + + &newline; + + + + .SH AUTHOR + &newline; + + + + + + + + + &newline; + + .P + &newline; + + &newline; + + + + &newline; + &newline; + + + + + + + + &newline; + .ft CW + &newline; + .nf + &newline; + + + + &newline; + .ft R + &newline; + .fi + &newline; + + + + + + + + + + + + + + + + + .TP&newline; + .B + + &newline; + + + + + &newline; + + + + + + &newline; + &newline; + + + + + &newline; + \fB + + \fR + + + + &newline; + \fI + + \fR + + + + + + + + + + &newline; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch b/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch new file mode 100644 index 0000000..a1e5580 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8-ipc-caps.patch @@ -0,0 +1,16 @@ +http://bugs.ntp.org/show_bug.cgi?id=2646 +https://bugs.gentoo.org/533966 + +--- a/ntpd/ntpd.c ++++ a/ntpd/ntpd.c +@@ -971,8 +971,8 @@ getgroup: + char *captext; + + captext = (0 != interface_interval) +- ? "cap_sys_time,cap_net_bind_service=pe" +- : "cap_sys_time=pe"; ++ ? "cap_ipc_lock,cap_sys_time,cap_net_bind_service=pe" ++ : "cap_ipc_lock,cap_sys_time=pe"; + caps = cap_from_text(captext); + if (!caps) { + msyslog(LOG_ERR, diff --git a/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch b/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch new file mode 100644 index 0000000..4f8d15f --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8-sntp-test-pthreads.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/563922 +http://bugs.ntp.org/show_bug.cgi?id=2906 + +--- a/sntp/tests/Makefile.in ++++ b/sntp/tests/Makefile.in +@@ -783,6 +783,7 @@ base_LDADD = \ + $(LIBOPTS_LDADD) \ + $(LDADD_LIBEVENT) \ + $(top_builddir)/../libntp/libntp.a \ ++ $(PTHREAD_LIBS) \ + $(LDADD_LIBNTP) \ + $(LDADD_NTP) \ + $(NULL) diff --git a/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch new file mode 100644 index 0000000..1b532c6 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch @@ -0,0 +1,39 @@ +Fix building with libressl or without SSL. + +Origin: http://bugs.ntp.org/attachment.cgi?id=1481 + +LibreSSL fix from Joe Kappus (https://bugs.gentoo.org/show_bug.cgi?id=600668#c2) + +--- a/include/libssl_compat.h ++++ b/include/libssl_compat.h +@@ -37,7 +37,7 @@ + #endif + + /* ----------------------------------------------------------------- */ +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + /* ----------------------------------------------------------------- */ + + # include +--- a/libntp/libssl_compat.c ++++ b/libntp/libssl_compat.c +@@ -26,7 +26,7 @@ + /* ----------------------------------------------------------------- */ + + /* ----------------------------------------------------------------- */ +-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L ++#if defined(OPENSSL) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) + /* ----------------------------------------------------------------- */ + + #include "libssl_compat.h" +--- a/libntp/ssl_init.c ++++ b/libntp/ssl_init.c +@@ -21,7 +21,7 @@ + + int ssl_init_done; + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + + static void + atexit_ssl_cleanup(void) diff --git a/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch b/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch new file mode 100644 index 0000000..182fcef --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p12-libressl-2.8.patch @@ -0,0 +1,16 @@ +--- ntp-4.2.8p12.orig/include/libssl_compat.h 2018-12-08 01:14:58.434733497 +0000 ++++ ntp-4.2.8p12/include/libssl_compat.h 2018-12-08 01:42:04.479474757 +0000 +@@ -107,10 +107,13 @@ + + #define OpenSSL_version_num SSLeay + #define OpenSSL_version SSLeay_version ++ ++# if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L + #define X509_get0_notBefore X509_get_notBefore + #define X509_getm_notBefore X509_get_notBefore + #define X509_get0_notAfter X509_get_notAfter + #define X509_getm_notAfter X509_get_notAfter ++#endif /* !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L */ + + /* ----------------------------------------------------------------- */ + #endif /* OPENSSL_VERSION_NUMBER < v1.1.0 */ diff --git a/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch b/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch new file mode 100644 index 0000000..183b6d8 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p14-add_cap_ipc_lock.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/711530 + +--- ntp-4.2.8p14/ntpd/ntpd.c ++++ ntp-4.2.8p14/ntpd/ntpd.c +@@ -1189,7 +1189,7 @@ + * drop privileges in this case. + */ + cap_t caps; +- caps = cap_from_text("cap_sys_time,cap_setuid,cap_setgid,cap_sys_chroot,cap_net_bind_service=pe"); ++ caps = cap_from_text("cap_ipc_lock,cap_sys_time,cap_setuid,cap_setgid,cap_sys_chroot,cap_net_bind_service=pe"); + if ( ! caps) { + msyslog( LOG_ERR, "cap_from_text() failed: %m" ); + exit(-1); diff --git a/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch b/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch new file mode 100644 index 0000000..619ea07 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.8_p15-gcc10.patch @@ -0,0 +1,75 @@ + +Source: +https://bugs.ntp.org/show_bug.cgi?id=3688 + +Juergen Perlinger 2020-12-24 07:10:49 UTC +Created attachment 1760 [details] +ultimate patch, v00 + +--- a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100 ++++ a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100 +@@ -2,7 +2,7 @@ + + #include "log.h" + +-const char *progname; /* for msyslog use too */ ++extern const char *progname; /* for msyslog use too */ + + static int counter = 0; + +--- a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100 +@@ -20,7 +20,6 @@ + #include "log.h" + #include "libntp.h" + +- + int shutting_down; + int time_derived; + int time_adjusted; +--- a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100 +@@ -16,6 +16,14 @@ + + #include "crypto.h" + ++/* !Attention! 'progname' must de instantiated in any program that wants ++ * to use this library. Putting it into the library breaks a lot of ++ * things, since many programs define it itself and then the symbol ++ * might end up twice in the linker. ++ */ ++extern const char * progname; ++ ++ + void set_li_vn_mode(struct pkt *spkt, char leap, char version, char mode); + extern int sntp_main(int argc, char **argv, const char *); + int generate_pkt(struct pkt *x_pkt, const struct timeval *tv_xmt, +--- a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100 +@@ -2,6 +2,8 @@ + + #include "main.h" + ++const char * progname; ++ + int + main ( + int argc, +--- a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100 ++++ a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100 +@@ -3,7 +3,6 @@ + #include "ntp_types.h" + + +-//#include "log.h" + #include "log.c" + + void setUp(void); +--- a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100 ++++ a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100 +@@ -5,4 +5,4 @@ + + time_t timefunc(time_t *ptr); + void settime(int y, int m, int d, int H, int M, int S); +-time_t nowtime; ++extern time_t nowtime; diff --git a/net-misc/ntp/files/ntp-client.confd b/net-misc/ntp/files/ntp-client.confd new file mode 100644 index 0000000..786004d --- /dev/null +++ b/net-misc/ntp/files/ntp-client.confd @@ -0,0 +1,21 @@ +# /etc/conf.d/ntp-client + +# Command to run to set the clock initially +# Most people should just leave this line alone ... +# however, if you know what you're doing, and you +# want to use ntpd to set the clock, change this to 'ntpd' +NTPCLIENT_CMD="ntpdate" + +# Options to pass to the above command +# This default setting should work fine but you should +# change the default 'pool.ntp.org' to something closer +# to your machine. See http://www.pool.ntp.org/ or +# try running `netselect -s 3 pool.ntp.org`. +NTPCLIENT_OPTS="-s -b -u \ + 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \ + 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" + +# If you use hostnames above, then you should depend on dns +# being up & running before we try to run. Otherwise, you +# can disable this. +rc_use="dns" diff --git a/net-misc/ntp/files/ntp-client.rc b/net-misc/ntp/files/ntp-client.rc new file mode 100644 index 0000000..b3e3a81 --- /dev/null +++ b/net-misc/ntp/files/ntp-client.rc @@ -0,0 +1,31 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before cron portmap + after net + use dns logger +} + +checkconfig() { + if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "Unable to locate the client command ${NTPCLIENT_CMD}!" + return 1 + fi + if [ -z "${NTPCLIENT_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + checkconfig || return $? + + ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'" + "${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/ntp.conf b/net-misc/ntp/files/ntp.conf new file mode 100644 index 0000000..97bed8d --- /dev/null +++ b/net-misc/ntp/files/ntp.conf @@ -0,0 +1,54 @@ +# NOTES: +# DHCP clients can append or replace NTP configuration files. +# You should consult your DHCP client documentation about its +# default behaviour and how to change it. + +# Name of the servers ntpd should sync with +# Please respect the access policy as stated by the responsible person. +#server ntp.example.tld iburst + +# Common pool for random people +#server pool.ntp.org + +# Pools for Gentoo users +server 0.gentoo.pool.ntp.org +server 1.gentoo.pool.ntp.org +server 2.gentoo.pool.ntp.org +server 3.gentoo.pool.ntp.org + +## +# A list of available servers can be found here: +# http://www.pool.ntp.org/ +# http://www.pool.ntp.org/#use +# A good way to get servers for your machine is: +# netselect -s 3 pool.ntp.org +## + +# you should not need to modify the following paths +driftfile /var/lib/ntp/ntp.drift + +#server ntplocal.example.com prefer +#server timeserver.example.org + +# Warning: Using default NTP settings will leave your NTP +# server accessible to all hosts on the Internet. + +# If you want to deny all machines (including your own) +# from accessing the NTP server, uncomment: +#restrict default ignore + + +# Default configuration: +# - Allow only time queries, at a limited rate, sending KoD when in excess. +# - Allow all local queries (IPv4, IPv6) +restrict default nomodify nopeer noquery limited kod +restrict 127.0.0.1 +restrict [::1] + + +# To allow machines within your network to synchronize +# their clocks with your server, but ensure they are +# not allowed to configure the server or used as peers +# to synchronize against, uncomment this line. +# +#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap diff --git a/net-misc/ntp/files/ntpd.confd b/net-misc/ntp/files/ntpd.confd new file mode 100644 index 0000000..2b74282 --- /dev/null +++ b/net-misc/ntp/files/ntpd.confd @@ -0,0 +1,6 @@ +# /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 -u ntp:ntp" diff --git a/net-misc/ntp/files/ntpd.rc-r1 b/net-misc/ntp/files/ntpd.rc-r1 new file mode 100644 index 0000000..e6e7aa1 --- /dev/null +++ b/net-misc/ntp/files/ntpd.rc-r1 @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +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/ntp/files/ntpd.service-r2 b/net-misc/ntp/files/ntpd.service-r2 new file mode 100644 index 0000000..5f11b27 --- /dev/null +++ b/net-misc/ntp/files/ntpd.service-r2 @@ -0,0 +1,11 @@ +[Unit] +Description=Network Time Service +After=ntpdate.service sntp.service +Conflicts=systemd-timesyncd.service + +[Service] +ExecStart=/usr/sbin/ntpd -g -n +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/ntpdate.service-r2 b/net-misc/ntp/files/ntpdate.service-r2 new file mode 100644 index 0000000..7ad294e --- /dev/null +++ b/net-misc/ntp/files/ntpdate.service-r2 @@ -0,0 +1,14 @@ +[Unit] +Description=Set time via NTP using ntpdate +After=network-online.target nss-lookup.target +Before=time-sync.target +Wants=network-online.target time-sync.target +Conflicts=systemd-timesyncd.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/ntpdate -b -u $SERVER +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/ntpdate.service.conf b/net-misc/ntp/files/ntpdate.service.conf new file mode 100644 index 0000000..75e4f41 --- /dev/null +++ b/net-misc/ntp/files/ntpdate.service.conf @@ -0,0 +1,2 @@ +[Service] +Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/files/sntp.confd b/net-misc/ntp/files/sntp.confd new file mode 100644 index 0000000..d11983a --- /dev/null +++ b/net-misc/ntp/files/sntp.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/sntp + +# Options to pass to sntp +SNTP_OPTS="-s 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/files/sntp.rc b/net-misc/ntp/files/sntp.rc new file mode 100644 index 0000000..cbe9911 --- /dev/null +++ b/net-misc/ntp/files/sntp.rc @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/sntp" + +depend() { + before cron portmap + after net + use dns logger +} + +start_pre() { + if [ -z "${SNTP_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/sntp" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + ebegin "Setting clock via SNTP" + ${command} ${SNTP_OPTS} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/sntp.service-r3 b/net-misc/ntp/files/sntp.service-r3 new file mode 100644 index 0000000..2ab722f --- /dev/null +++ b/net-misc/ntp/files/sntp.service-r3 @@ -0,0 +1,14 @@ +[Unit] +Description=Set time via SNTP +After=network.target network-online.target nss-lookup.target +Before=time-sync.target +Wants=network-online.target time-sync.target +Conflicts=systemd-timesyncd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/sntp -s $SERVER +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/net-misc/ntp/files/sntp.service.conf b/net-misc/ntp/files/sntp.service.conf new file mode 100644 index 0000000..75e4f41 --- /dev/null +++ b/net-misc/ntp/files/sntp.service.conf @@ -0,0 +1,2 @@ +[Service] +Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org" diff --git a/net-misc/ntp/metadata.xml b/net-misc/ntp/metadata.xml new file mode 100644 index 0000000..88e81f1 --- /dev/null +++ b/net-misc/ntp/metadata.xml @@ -0,0 +1,23 @@ + + + + + base-system@gentoo.org + Gentoo Base System + + +NTP is a protocol designed to synchronize the clocks of computers over a network. NTP +version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a +significant revision of the NTP standard, and is the current development version, but +has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC +2030. + + + Allow ntp to be installed alongside openntpd + Add support for PARSE clocks + Provide support for Samba's signing daemon (needed for Active Directory domain controllers) + + + cpe:/a:ntp:ntp + + diff --git a/net-misc/ntp/ntp-4.2.8_p15.ebuild b/net-misc/ntp/ntp-4.2.8_p15.ebuild new file mode 100644 index 0000000..1405367 --- /dev/null +++ b/net-misc/ntp/ntp-4.2.8_p15.ebuild @@ -0,0 +1,145 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools toolchain-funcs flag-o-matic systemd + +MY_P=${P/_p/p} +DESCRIPTION="Network Time Protocol suite/programs" +HOMEPAGE="http://www.ntp.org/" +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz + https://dev.gentoo.org/~polynomial-c/${MY_P}-manpages.tar.xz" + +LICENSE="HPND BSD ISC" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux" +IUSE="caps debug ipv6 libressl openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf" + +COMMON_DEPEND="readline? ( >=sys-libs/readline-4.1:0= ) + >=dev-libs/libevent-2.0.9:=[threads?] + kernel_linux? ( caps? ( sys-libs/libcap ) ) + zeroconf? ( net-dns/avahi[mdnsresponder-compat] ) + snmp? ( net-analyzer/net-snmp ) + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + parse-clocks? ( net-misc/pps-tools )" +BDEPEND="virtual/pkgconfig + acct-group/ntp + acct-user/ntp" +DEPEND="${COMMON_DEPEND}" +RDEPEND="${COMMON_DEPEND} + acct-group/ntp + acct-user/ntp + selinux? ( sec-policy/selinux-ntp ) + vim-syntax? ( app-vim/ntp-syntax ) + !net-misc/ntpsec + !openntpd? ( !net-misc/openntpd ) +" +PDEPEND="openntpd? ( net-misc/openntpd )" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966 + "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922 + "${FILESDIR}"/${PN}-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch + "${FILESDIR}"/${PN}-4.2.8_p12-libressl-2.8.patch + "${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch #711530 + "${FILESDIR}"/${PN}-4.2.8_p15-gcc10.patch #759409 +) + +src_prepare() { + default + append-cppflags -D_GNU_SOURCE #264109 + # Make sure every build uses the same install layout. #539092 + find sntp/loc/ -type f '!' -name legacy -delete || die + eautoreconf #622754 + # Disable pointless checks. + touch .checkChangeLog .gcc-warning FRC.html html/.datecheck +} + +src_configure() { + # avoid libmd5/libelf + export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no + export ac_cv_lib_elf_nlist=no + # blah, no real configure options #176333 + export ac_cv_header_dns_sd_h=$(usex zeroconf) + export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h} + local myeconfargs=( + --with-lineeditlibs=readline,edit,editline + --with-yielding-select + --disable-local-libevent + # Increase the default memlimit from 32MiB to 128MiB. #533232 + --with-memlock=256 + $(use_enable caps linuxcaps) + $(use_enable parse-clocks) + $(use_enable ipv6) + $(use_enable debug debugging) + $(use_with readline lineeditlibs readline) + $(use_enable samba ntp-signd) + $(use_with snmp ntpsnmpd) + $(use_with ssl crypto) + $(use_enable threads thread-support) + ) + econf "${myeconfargs[@]}" +} + +src_install() { + default + # move ntpd/ntpdate to sbin #66671 + dodir /usr/sbin + mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin" + + dodoc INSTALL WHERE-TO-START + doman "${WORKDIR}"/man/*.[58] + + insinto /etc + doins "${FILESDIR}"/ntp.conf + use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf #524726 + newinitd "${FILESDIR}"/ntpd.rc-r1 ntpd + newconfd "${FILESDIR}"/ntpd.confd ntpd + newinitd "${FILESDIR}"/ntp-client.rc ntp-client + newconfd "${FILESDIR}"/ntp-client.confd ntp-client + newinitd "${FILESDIR}"/sntp.rc sntp + newconfd "${FILESDIR}"/sntp.confd sntp + if ! use caps ; then + sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die + fi + sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die + + keepdir /var/lib/ntp + use prefix || fowners ntp:ntp /var/lib/ntp + + if use openntpd ; then + cd "${ED}" || die + rm usr/sbin/ntpd || die + rm -r var/lib || die + rm etc/{conf,init}.d/ntpd || die + rm usr/share/man/*/ntpd.8 || die + else + systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service + if use caps ; then + sed -i '/ExecStart/ s|$| -u ntp:ntp|' \ + "${D}$(systemd_get_systemunitdir)"/ntpd.service \ + || die + fi + systemd_enable_ntpunit 60-ntpd ntpd.service + fi + + systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service + systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf + systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service + systemd_install_serviced "${FILESDIR}"/sntp.service.conf +} + +pkg_postinst() { + if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then + eerror "The notrust option was found in your /etc/ntp.conf!" + ewarn "If your ntpd starts sending out weird responses," + ewarn "then make sure you have keys properly setup and see" + ewarn "https://bugs.gentoo.org/41827" + fi +}