Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/ntp/, net-misc/ntp/files/
Date: Fri, 03 Jun 2022 05:32:51
Message-Id: 1654234158.d8c9b791ed0c3c23ef26ded620334d55f2587758.sam@gentoo
1 commit: d8c9b791ed0c3c23ef26ded620334d55f2587758
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 3 05:15:24 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 05:29:18 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8c9b791
7
8 net-misc/ntp: improve OpenRC init script for ntpd
9
10 The attached script updates a couple things which effectively is the same
11 as the current model however it follows the modular nature of the declarative
12 syntax.
13
14 Changes:
15 * Removes the duplicating start_stop_daemon_args since --pidfile is
16 automatic with pidfile=
17 * Only have ntpd create the pidfile when forking via command_args_background
18 * Add command_args_foreground for the option not to fork
19
20 Closes: https://bugs.gentoo.org/828077
21 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
22 Signed-off-by: Sam James <sam <AT> gentoo.org>
23
24 net-misc/ntp/files/ntpd.rc-r2 | 23 ++++++
25 net-misc/ntp/ntp-4.2.8_p15-r1.ebuild | 143 +++++++++++++++++++++++++++++++++++
26 2 files changed, 166 insertions(+)
27
28 diff --git a/net-misc/ntp/files/ntpd.rc-r2 b/net-misc/ntp/files/ntpd.rc-r2
29 new file mode 100644
30 index 000000000000..f4608f784615
31 --- /dev/null
32 +++ b/net-misc/ntp/files/ntpd.rc-r2
33 @@ -0,0 +1,23 @@
34 +#!/sbin/openrc-run
35 +# Copyright 1999-2021 Gentoo Foundation
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +description="ntpd - the network time protocol daemon"
39 +pidfile="/var/run/ntpd.pid"
40 +command="/usr/sbin/ntpd"
41 +command_args="${NTPD_OPTS}"
42 +command_args_background="-p ${pidfile}"
43 +command_args_foreground="-n"
44 +
45 +depend() {
46 + use net dns logger
47 + after ntp-client
48 +}
49 +
50 +start_pre() {
51 + if [ ! -f /etc/ntp.conf ] ; then
52 + eerror "Please create /etc/ntp.conf"
53 + return 1
54 + fi
55 + return 0
56 +}
57
58 diff --git a/net-misc/ntp/ntp-4.2.8_p15-r1.ebuild b/net-misc/ntp/ntp-4.2.8_p15-r1.ebuild
59 new file mode 100644
60 index 000000000000..7e0c42fe3689
61 --- /dev/null
62 +++ b/net-misc/ntp/ntp-4.2.8_p15-r1.ebuild
63 @@ -0,0 +1,143 @@
64 +# Copyright 1999-2022 Gentoo Authors
65 +# Distributed under the terms of the GNU General Public License v2
66 +
67 +EAPI=7
68 +
69 +inherit autotools flag-o-matic systemd
70 +
71 +MY_P=${P/_p/p}
72 +DESCRIPTION="Network Time Protocol suite/programs"
73 +HOMEPAGE="http://www.ntp.org/"
74 +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz
75 + https://dev.gentoo.org/~polynomial-c/${MY_P}-manpages.tar.xz"
76 +
77 +LICENSE="HPND BSD ISC"
78 +SLOT="0"
79 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
80 +IUSE="caps debug ipv6 openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf"
81 +
82 +COMMON_DEPEND="readline? ( >=sys-libs/readline-4.1:0= )
83 + >=dev-libs/libevent-2.0.9:=[threads?]
84 + kernel_linux? ( caps? ( sys-libs/libcap ) )
85 + zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
86 + snmp? ( net-analyzer/net-snmp )
87 + ssl? (
88 + dev-libs/openssl:0=
89 + )
90 + parse-clocks? ( net-misc/pps-tools )"
91 +BDEPEND="virtual/pkgconfig
92 + acct-group/ntp
93 + acct-user/ntp"
94 +DEPEND="${COMMON_DEPEND}"
95 +RDEPEND="${COMMON_DEPEND}
96 + acct-group/ntp
97 + acct-user/ntp
98 + selinux? ( sec-policy/selinux-ntp )
99 + vim-syntax? ( app-vim/ntp-syntax )
100 + !net-misc/ntpsec
101 + !openntpd? ( !net-misc/openntpd )
102 +"
103 +PDEPEND="openntpd? ( net-misc/openntpd )"
104 +
105 +S="${WORKDIR}/${MY_P}"
106 +
107 +PATCHES=(
108 + "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966
109 + "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922
110 + "${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch #711530
111 + "${FILESDIR}"/${PN}-4.2.8_p15-gcc10.patch #759409
112 + "${FILESDIR}"/${PN}-4.2.8_p15-glibc-2.34.patch
113 +)
114 +
115 +src_prepare() {
116 + default
117 + append-cppflags -D_GNU_SOURCE #264109
118 + # Make sure every build uses the same install layout. #539092
119 + find sntp/loc/ -type f '!' -name legacy -delete || die
120 + eautoreconf #622754
121 + # Disable pointless checks.
122 + touch .checkChangeLog .gcc-warning FRC.html html/.datecheck
123 +}
124 +
125 +src_configure() {
126 + # avoid libmd5/libelf
127 + export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no
128 + export ac_cv_lib_elf_nlist=no
129 + # blah, no real configure options #176333
130 + export ac_cv_header_dns_sd_h=$(usex zeroconf)
131 + export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
132 + local myeconfargs=(
133 + --with-lineeditlibs=readline,edit,editline
134 + --with-yielding-select
135 + --disable-local-libevent
136 + # Increase the default memlimit from 32MiB to 128MiB. #533232
137 + --with-memlock=256
138 + $(use_enable caps linuxcaps)
139 + $(use_enable parse-clocks)
140 + $(use_enable ipv6)
141 + $(use_enable debug debugging)
142 + $(use_with readline lineeditlibs readline)
143 + $(use_enable samba ntp-signd)
144 + $(use_with snmp ntpsnmpd)
145 + $(use_with ssl crypto)
146 + $(use_enable threads thread-support)
147 + )
148 + econf "${myeconfargs[@]}"
149 +}
150 +
151 +src_install() {
152 + default
153 + # move ntpd/ntpdate to sbin #66671
154 + dodir /usr/sbin
155 + mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin"
156 +
157 + dodoc INSTALL WHERE-TO-START
158 + doman "${WORKDIR}"/man/*.[58]
159 +
160 + insinto /etc
161 + doins "${FILESDIR}"/ntp.conf
162 + use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf #524726
163 + newinitd "${FILESDIR}"/ntpd.rc-r2 ntpd
164 + newconfd "${FILESDIR}"/ntpd.confd ntpd
165 + newinitd "${FILESDIR}"/ntp-client.rc ntp-client
166 + newconfd "${FILESDIR}"/ntp-client.confd ntp-client
167 + newinitd "${FILESDIR}"/sntp.rc sntp
168 + newconfd "${FILESDIR}"/sntp.confd sntp
169 + if ! use caps ; then
170 + sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die
171 + fi
172 + sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die
173 +
174 + keepdir /var/lib/ntp
175 + use prefix || fowners ntp:ntp /var/lib/ntp
176 +
177 + if use openntpd ; then
178 + cd "${ED}" || die
179 + rm usr/sbin/ntpd || die
180 + rm -r var/lib || die
181 + rm etc/{conf,init}.d/ntpd || die
182 + rm usr/share/man/*/ntpd.8 || die
183 + else
184 + systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service
185 + if use caps ; then
186 + sed -i '/ExecStart/ s|$| -u ntp:ntp|' \
187 + "${D}$(systemd_get_systemunitdir)"/ntpd.service \
188 + || die
189 + fi
190 + systemd_enable_ntpunit 60-ntpd ntpd.service
191 + fi
192 +
193 + systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service
194 + systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf
195 + systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service
196 + systemd_install_serviced "${FILESDIR}"/sntp.service.conf
197 +}
198 +
199 +pkg_postinst() {
200 + if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then
201 + eerror "The notrust option was found in your /etc/ntp.conf!"
202 + ewarn "If your ntpd starts sending out weird responses,"
203 + ewarn "then make sure you have keys properly setup and see"
204 + ewarn "https://bugs.gentoo.org/41827"
205 + fi
206 +}