Gentoo Archives: gentoo-commits

From: Craig Andrews <candrews@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/ntp/files/, net-misc/ntp/
Date: Tue, 27 Aug 2019 18:50:43
Message-Id: 1566931400.e4b4dea3d09eef699a51f915e96e53db6084b46b.candrews@gentoo
1 commit: e4b4dea3d09eef699a51f915e96e53db6084b46b
2 Author: Craig Andrews <candrews <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 27 18:30:25 2019 +0000
4 Commit: Craig Andrews <candrews <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 27 18:43:20 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4b4dea3
7
8 net-misc/ntp: systemd service improvements
9
10 systemd services Wants=network-online.target
11 Remove explicit reference to NetworkManager,
12 use generic network-online.target instead
13
14 Closes: https://bugs.gentoo.org/658608
15 Package-Manager: Portage-2.3.73, Repoman-2.3.17
16 Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
17
18 net-misc/ntp/files/ntpdate.service-r2 | 14 ++++
19 net-misc/ntp/files/sntp.service-r3 | 14 ++++
20 net-misc/ntp/ntp-4.2.8_p13-r1.ebuild | 146 ++++++++++++++++++++++++++++++++++
21 3 files changed, 174 insertions(+)
22
23 diff --git a/net-misc/ntp/files/ntpdate.service-r2 b/net-misc/ntp/files/ntpdate.service-r2
24 new file mode 100644
25 index 00000000000..7ad294eccde
26 --- /dev/null
27 +++ b/net-misc/ntp/files/ntpdate.service-r2
28 @@ -0,0 +1,14 @@
29 +[Unit]
30 +Description=Set time via NTP using ntpdate
31 +After=network-online.target nss-lookup.target
32 +Before=time-sync.target
33 +Wants=network-online.target time-sync.target
34 +Conflicts=systemd-timesyncd.service
35 +
36 +[Service]
37 +Type=oneshot
38 +ExecStart=/usr/sbin/ntpdate -b -u $SERVER
39 +RemainAfterExit=yes
40 +
41 +[Install]
42 +WantedBy=multi-user.target
43
44 diff --git a/net-misc/ntp/files/sntp.service-r3 b/net-misc/ntp/files/sntp.service-r3
45 new file mode 100644
46 index 00000000000..2ab722f2c6f
47 --- /dev/null
48 +++ b/net-misc/ntp/files/sntp.service-r3
49 @@ -0,0 +1,14 @@
50 +[Unit]
51 +Description=Set time via SNTP
52 +After=network.target network-online.target nss-lookup.target
53 +Before=time-sync.target
54 +Wants=network-online.target time-sync.target
55 +Conflicts=systemd-timesyncd.service
56 +
57 +[Service]
58 +Type=oneshot
59 +ExecStart=/usr/bin/sntp -s $SERVER
60 +RemainAfterExit=yes
61 +
62 +[Install]
63 +WantedBy=multi-user.target
64
65 diff --git a/net-misc/ntp/ntp-4.2.8_p13-r1.ebuild b/net-misc/ntp/ntp-4.2.8_p13-r1.ebuild
66 new file mode 100644
67 index 00000000000..75150d17139
68 --- /dev/null
69 +++ b/net-misc/ntp/ntp-4.2.8_p13-r1.ebuild
70 @@ -0,0 +1,146 @@
71 +# Copyright 1999-2019 Gentoo Authors
72 +# Distributed under the terms of the GNU General Public License v2
73 +
74 +EAPI=6
75 +
76 +inherit autotools toolchain-funcs flag-o-matic user systemd
77 +
78 +MY_P=${P/_p/p}
79 +DESCRIPTION="Network Time Protocol suite/programs"
80 +HOMEPAGE="http://www.ntp.org/"
81 +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz
82 + https://dev.gentoo.org/~polynomial-c/${MY_P}-manpages.tar.xz"
83 +
84 +LICENSE="HPND BSD ISC"
85 +SLOT="0"
86 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~m68k-mint"
87 +IUSE="caps debug ipv6 libressl openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf"
88 +
89 +CDEPEND="readline? ( >=sys-libs/readline-4.1:0= )
90 + >=dev-libs/libevent-2.0.9:=[threads?]
91 + kernel_linux? ( caps? ( sys-libs/libcap ) )
92 + zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
93 + snmp? ( net-analyzer/net-snmp )
94 + ssl? (
95 + !libressl? ( dev-libs/openssl:0= )
96 + libressl? ( dev-libs/libressl:0= )
97 + )
98 + parse-clocks? ( net-misc/pps-tools )"
99 +DEPEND="${CDEPEND}
100 + virtual/pkgconfig"
101 +RDEPEND="${CDEPEND}
102 + selinux? ( sec-policy/selinux-ntp )
103 + vim-syntax? ( app-vim/ntp-syntax )
104 + !net-misc/ntpsec
105 + !openntpd? ( !net-misc/openntpd )
106 +"
107 +PDEPEND="openntpd? ( net-misc/openntpd )"
108 +
109 +S="${WORKDIR}/${MY_P}"
110 +
111 +PATCHES=(
112 + "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966
113 + "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922
114 + "${FILESDIR}"/${PN}-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch
115 + "${FILESDIR}"/${PN}-4.2.8_p12-libressl-2.8.patch
116 +)
117 +
118 +pkg_setup() {
119 + enewgroup ntp 123
120 + enewuser ntp 123 -1 /dev/null ntp
121 +}
122 +
123 +src_prepare() {
124 + default
125 + append-cppflags -D_GNU_SOURCE #264109
126 + # Make sure every build uses the same install layout. #539092
127 + find sntp/loc/ -type f '!' -name legacy -delete || die
128 + eautoreconf #622754
129 + # Disable pointless checks.
130 + touch .checkChangeLog .gcc-warning FRC.html html/.datecheck
131 +}
132 +
133 +src_configure() {
134 + # avoid libmd5/libelf
135 + export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no
136 + export ac_cv_lib_elf_nlist=no
137 + # blah, no real configure options #176333
138 + export ac_cv_header_dns_sd_h=$(usex zeroconf)
139 + export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
140 + # Increase the default memlimit from 32MiB to 128MiB. #533232
141 + local myeconfargs=(
142 + --with-lineeditlibs=readline,edit,editline
143 + --with-yielding-select
144 + --disable-local-libevent
145 + --docdir='$(datarootdir)'/doc/${PF}
146 + --htmldir='$(docdir)/html'
147 + --with-memlock=256
148 + $(use_enable caps linuxcaps)
149 + $(use_enable parse-clocks)
150 + $(use_enable ipv6)
151 + $(use_enable debug debugging)
152 + $(use_with readline lineeditlibs readline)
153 + $(use_enable samba ntp-signd)
154 + $(use_with snmp ntpsnmpd)
155 + $(use_with ssl crypto)
156 + $(use_enable threads thread-support)
157 + )
158 + econf "${myeconfargs[@]}"
159 +}
160 +
161 +src_install() {
162 + default
163 + # move ntpd/ntpdate to sbin #66671
164 + dodir /usr/sbin
165 + mv "${ED%/}"/usr/bin/{ntpd,ntpdate} "${ED%/}"/usr/sbin/ || die "move to sbin"
166 +
167 + dodoc INSTALL WHERE-TO-START
168 + doman "${WORKDIR}"/man/*.[58]
169 +
170 + insinto /etc
171 + doins "${FILESDIR}"/ntp.conf
172 + use ipv6 || sed -i '/^restrict .*::1/d' "${ED%/}"/etc/ntp.conf #524726
173 + newinitd "${FILESDIR}"/ntpd.rc-r1 ntpd
174 + newconfd "${FILESDIR}"/ntpd.confd ntpd
175 + newinitd "${FILESDIR}"/ntp-client.rc ntp-client
176 + newconfd "${FILESDIR}"/ntp-client.confd ntp-client
177 + newinitd "${FILESDIR}"/sntp.rc sntp
178 + newconfd "${FILESDIR}"/sntp.confd sntp
179 + if ! use caps ; then
180 + sed -i "s|-u ntp:ntp||" "${ED%/}"/etc/conf.d/ntpd || die
181 + fi
182 + sed -i "s:/usr/bin:/usr/sbin:" "${ED%/}"/etc/init.d/ntpd || die
183 +
184 + keepdir /var/lib/ntp
185 + use prefix || fowners ntp:ntp /var/lib/ntp
186 +
187 + if use openntpd ; then
188 + cd "${ED}" || die
189 + rm usr/sbin/ntpd || die
190 + rm -r var/lib || die
191 + rm etc/{conf,init}.d/ntpd || die
192 + rm usr/share/man/*/ntpd.8 || die
193 + else
194 + systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service
195 + if use caps ; then
196 + sed -i '/ExecStart/ s|$| -u ntp:ntp|' \
197 + "${D%/}$(systemd_get_systemunitdir)"/ntpd.service \
198 + || die
199 + fi
200 + systemd_enable_ntpunit 60-ntpd ntpd.service
201 + fi
202 +
203 + systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service
204 + systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf
205 + systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service
206 + systemd_install_serviced "${FILESDIR}"/sntp.service.conf
207 +}
208 +
209 +pkg_postinst() {
210 + if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then
211 + eerror "The notrust option was found in your /etc/ntp.conf!"
212 + ewarn "If your ntpd starts sending out weird responses,"
213 + ewarn "then make sure you have keys properly setup and see"
214 + ewarn "https://bugs.gentoo.org/41827"
215 + fi
216 +}