Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/munin/
Date: Mon, 02 Dec 2019 10:19:26
Message-Id: 1575281920.5f38307d2100082d5bb3ab89046f64df8b32e0f0.graaff@gentoo
1 commit: 5f38307d2100082d5bb3ab89046f64df8b32e0f0
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 2 09:53:55 2019 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 2 10:18:40 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f38307d
7
8 net-analyzer/munin: add 2.0.52
9
10 Fixes: https://bugs.gentoo.org/701680
11 Fixes: https://bugs.gentoo.org/693946
12 Package-Manager: Portage-2.3.79, Repoman-2.3.16
13 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
14
15 net-analyzer/munin/Manifest | 2 +
16 net-analyzer/munin/munin-2.0.52.ebuild | 419 +++++++++++++++++++++++++++++++++
17 2 files changed, 421 insertions(+)
18
19 diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest
20 index 7c670332aeb..201ecf8ce6a 100644
21 --- a/net-analyzer/munin/Manifest
22 +++ b/net-analyzer/munin/Manifest
23 @@ -1,2 +1,4 @@
24 DIST munin-2.0.49-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051a7f3a5dc8250776ab6ae1659197d795dfb87274db66ff0a3deb4e10e14ced5b3765551a3f29357c436968a848f450ea SHA512 b21d6590bb9e1da127066a06818f1f3157362762f80526e2231b926956959e62af575f38235f72326376dc21bba63f9767efa379f1f2558ca9b20ddf5395e851
25 DIST munin-2.0.49.tar.gz 2257501 BLAKE2B f2852357e3aa0c1ca3e217b66c3e2d1c0d9c70bf1f8487517ee913e2223ca1c5ae9b922c07f83754522c51fddd0f72f87f5ceea9b7e9642a44aab04ead44538f SHA512 e8bf652000ab76f16bc3b18a16c5231ffb5523fe9f78a90bec97ca31e46ff73566e1cbbf0a3616931d0b46ceb6f5a2b5d4fdc68c797539419a2217dccf643762
26 +DIST munin-2.0.52-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051a7f3a5dc8250776ab6ae1659197d795dfb87274db66ff0a3deb4e10e14ced5b3765551a3f29357c436968a848f450ea SHA512 b21d6590bb9e1da127066a06818f1f3157362762f80526e2231b926956959e62af575f38235f72326376dc21bba63f9767efa379f1f2558ca9b20ddf5395e851
27 +DIST munin-2.0.52.tar.gz 2266820 BLAKE2B 41233cd28ce4d682dfd47895061426404540c6b1c65798609a2d509d39ad5359b22087027662e7c03848e5676815843c34d078b782e3d0ab3a6a29b6a22e058b SHA512 7439ea10006a94227b71328d06411378f6855f23f17815a433b3a1c40ea23da5a25a366d48f911b9cfdc43c4b98f3bb9777b67db2b894441eb8941e84ede379c
28
29 diff --git a/net-analyzer/munin/munin-2.0.52.ebuild b/net-analyzer/munin/munin-2.0.52.ebuild
30 new file mode 100644
31 index 00000000000..b36fc5f88fc
32 --- /dev/null
33 +++ b/net-analyzer/munin/munin-2.0.52.ebuild
34 @@ -0,0 +1,419 @@
35 +# Copyright 1999-2019 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +PATCHSET=1
41 +
42 +inherit user java-pkg-opt-2 systemd
43 +
44 +MY_P=${P/_/-}
45 +
46 +DESCRIPTION="Munin Server Monitoring Tool"
47 +HOMEPAGE="http://munin-monitoring.org/"
48 +SRC_URI="
49 + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz
50 + https://dev.gentoo.org/~graaff/munin/${P}-gentoo-${PATCHSET}.tar.xz"
51 +
52 +LICENSE="GPL-2"
53 +SLOT="0"
54 +KEYWORDS="~amd64 ~arm ~ppc ~x86"
55 +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2"
56 +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )"
57 +RESTRICT="!test? ( test )"
58 +
59 +# Upstream's listing of required modules is NOT correct!
60 +# Some of the postgres plugins use DBD::Pg, while others call psql directly.
61 +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
62 +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
63 +DEPEND_COM="
64 + dev-lang/perl:=[berkdb]
65 + dev-perl/DBI
66 + dev-perl/Date-Manip
67 + dev-perl/File-Copy-Recursive
68 + dev-perl/List-MoreUtils
69 + dev-perl/Log-Log4perl
70 + dev-perl/Net-CIDR
71 + dev-perl/Net-DNS
72 + dev-perl/Net-Netmask
73 + dev-perl/Net-SNMP
74 + dev-perl/Net-Server[ipv6(-)?]
75 + virtual/perl-Digest-MD5
76 + virtual/perl-Getopt-Long
77 + virtual/perl-MIME-Base64
78 + virtual/perl-Storable
79 + virtual/perl-Text-Balanced
80 + virtual/perl-Time-HiRes
81 + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] )
82 + asterisk? ( dev-perl/Net-Telnet )
83 + cgi? (
84 + dev-perl/FCGI
85 + dev-perl/CGI-Fast
86 + )
87 + dhcpd? (
88 + >=net-misc/dhcp-3[server]
89 + dev-perl/Net-IP
90 + dev-perl/HTTP-Date
91 + )
92 + doc? ( dev-python/sphinx )
93 + http? ( dev-perl/libwww-perl )
94 + irc? ( dev-perl/Net-IRC )
95 + ldap? ( dev-perl/perl-ldap )
96 + kernel_linux? ( sys-process/procps )
97 + memcached? ( dev-perl/Cache-Memcached )
98 + mysql? (
99 + virtual/mysql
100 + dev-perl/Cache-Cache
101 + dev-perl/DBD-mysql
102 + )
103 + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* )
104 + ssl? ( dev-perl/Net-SSLeay )
105 + syslog? ( virtual/perl-Sys-Syslog )
106 + !minimal? (
107 + dev-perl/HTML-Template
108 + dev-perl/IO-Socket-INET6
109 + dev-perl/URI
110 + >=net-analyzer/rrdtool-1.3[graph,perl]
111 + virtual/ssh
112 + )
113 + "
114 +
115 +# Keep this seperate, as previous versions have had other deps here
116 +DEPEND="${DEPEND_COM}
117 + dev-perl/Module-Build
118 + java? ( >=virtual/jdk-1.5 )
119 + test? (
120 + dev-perl/Test-Deep
121 + dev-perl/Test-Exception
122 + dev-perl/Test-LongString
123 + dev-perl/Test-Differences
124 + dev-perl/Test-MockModule
125 + dev-perl/Test-MockObject
126 + dev-perl/File-Slurp
127 + dev-perl/IO-stringy
128 + dev-perl/IO-Socket-INET6
129 + )"
130 +RDEPEND="${DEPEND_COM}
131 + virtual/awk
132 + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 )
133 + java? (
134 + >=virtual/jre-1.5
135 + || ( net-analyzer/netcat net-analyzer/openbsd-netcat )
136 + )
137 + !minimal? (
138 + virtual/cron
139 + media-fonts/dejavu
140 + )
141 + selinux? ( sec-policy/selinux-munin )
142 + !<sys-apps/openrc-0.11.8"
143 +
144 +S="${WORKDIR}/${MY_P}"
145 +
146 +pkg_setup() {
147 + enewgroup munin
148 + enewuser munin 177 -1 /var/lib/munin munin
149 + enewuser munin-async -1 /bin/sh /var/spool/munin-async
150 + esethome munin-async /var/spool/munin-async
151 + java-pkg-opt-2_pkg_setup
152 +}
153 +
154 +src_prepare() {
155 + echo ${PV} > RELEASE || die
156 +
157 + eapply "${WORKDIR}"/patches/*.patch
158 +
159 + eapply_user
160 +
161 + java-pkg-opt-2_src_prepare
162 +}
163 +
164 +src_configure() {
165 + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi'
166 + use cgi || cgidir="${T}/useless/cgi-bin"
167 +
168 + local cgiuser=$(usex apache2 apache munin)
169 +
170 + cat >> "${S}"/Makefile.config <<- EOF
171 + PREFIX=\$(DESTDIR)/usr
172 + CONFDIR=\$(DESTDIR)/etc/munin
173 + DOCDIR=${T}/useless/doc
174 + MANDIR=\$(PREFIX)/share/man
175 + LIBDIR=\$(PREFIX)/libexec/munin
176 + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
177 + CGIDIR=${cgidir}
178 + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi
179 + CGIUSER=${cgiuser}
180 + DBDIR=\$(DESTDIR)/var/lib/munin
181 + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node
182 + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
183 + LOGDIR=\$(DESTDIR)/var/log/munin
184 + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2)
185 + JCVALID=$(usex java yes no)
186 + STATEDIR=\$(DESTDIR)/run/munin
187 + EOF
188 +}
189 +
190 +# parallel make and install need to be fixed before, and I haven't
191 +# gotten around to do so yet.
192 +src_compile() {
193 + emake -j1
194 + use doc && emake -C doc html
195 +}
196 +
197 +src_test() {
198 + if [[ ${EUID} == 0 ]]; then
199 + eerror "You cannot run tests as root."
200 + eerror "Please enable FEATURES=userpriv before proceeding."
201 + return 1
202 + fi
203 +
204 + local testtargets="test-common test-node test-plugins"
205 + use minimal || testtargets+=" test-master"
206 +
207 + LC_ALL=C emake -j1 ${testtargets}
208 +}
209 +
210 +src_install() {
211 + local dirs="
212 + /var/log/munin
213 + /var/lib/munin/plugin-state
214 + /var/lib/munin-node/plugin-state
215 + /var/www/localhost/htdocs/munin
216 + /etc/munin/plugin-conf.d
217 + /etc/munin/plugins"
218 + use minimal || dirs+=" /etc/munin/munin-conf.d/"
219 +
220 + keepdir ${dirs}
221 + fowners munin:munin ${dirs}
222 +
223 + # parallel install doesn't work and it's also pointless to have this
224 + # run in parallel for now (because it uses internal loops).
225 + emake -j1 CHOWN=true DESTDIR="${D}" $(usex minimal "install-minimal install-man" install)
226 +
227 + # we remove /run from the install, as it's not the package's to deal
228 + # with.
229 + rm -rf "${D}"/run || die
230 +
231 + # remove the plugins for non-Gentoo package managers; use -f so that
232 + # it doesn't fail when installing on non-Linux platforms.
233 + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
234 +
235 + insinto /etc/munin/plugin-conf.d/
236 + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
237 +
238 + newinitd "${FILESDIR}"/munin-node_init.d_2.0.19 munin-node
239 + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
240 +
241 + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd
242 +
243 + dodir /usr/lib/tmpfiles.d
244 + cat > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<- EOF
245 + d /run/munin 0700 munin munin - -
246 + EOF
247 +
248 + systemd_dounit "${FILESDIR}"/munin-async.service
249 + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket}
250 + systemd_dounit "${FILESDIR}"/munin-html.{service,socket}
251 + systemd_dounit "${FILESDIR}"/munin-node.service
252 +
253 + cat >> "${T}"/munin.env <<- EOF
254 + CONFIG_PROTECT=/var/spool/munin-async/.ssh
255 + EOF
256 + newenvd "${T}"/munin.env 50munin
257 +
258 + dodoc README ChangeLog INSTALL
259 + if use doc; then
260 + cd "${S}"/doc/_build/html || die
261 + docinto html
262 + dodoc -r *
263 + cd "${S}" || die
264 + fi
265 +
266 + dodir /etc/logrotate.d/
267 + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \
268 + "${FILESDIR}"/logrotate.d-munin.3 > "${D}"/etc/logrotate.d/munin
269 +
270 + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
271 +
272 + if use syslog; then
273 + sed -i -e '/log_file/s| .*| Sys::Syslog|' \
274 + "${D}"/etc/munin/munin-node.conf || die
275 + fi
276 +
277 + # Use a simpler pid file to avoid trouble with /run in tmpfs. The
278 + # munin-node service is ran as user root, and only later drops
279 + # privileges.
280 + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \
281 + "${D}"/etc/munin/munin-node.conf || die
282 +
283 + keepdir /var/spool/munin-async/.ssh
284 + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys
285 + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}}
286 + fperms 0750 /var/spool/munin-async{,/.ssh}
287 + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys
288 +
289 + if use minimal; then
290 + # This requires the presence of munin-update, which is part of
291 + # the non-minimal install...
292 + rm "${D}"/usr/libexec/munin/plugins/munin_stats
293 + else
294 + # remove font files so that we don't have to keep them around
295 + rm "${D}"/usr/libexec/${PN}/*.ttf || die
296 +
297 + if use cgi; then
298 + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
299 +
300 + keepdir /var/cache/munin-cgi
301 + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log
302 + fowners $(usex apache2 apache munin) \
303 + /var/cache/munin-cgi \
304 + /var/log/munin/munin-cgi-{graph,html}.log
305 +
306 + if use apache2; then
307 + insinto /etc/apache2/vhosts.d
308 + newins "${FILESDIR}"/munin.apache.include munin.include
309 + newins "${FILESDIR}"/munin.apache.include-2.4 munin-2.4.include
310 + fi
311 + else
312 + sed \
313 + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \
314 + -i "${D}"/etc/munin/munin.conf || die
315 + fi
316 +
317 + keepdir /var/lib/munin/.ssh
318 + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF
319 + IdentityFile /var/lib/munin/.ssh/id_ecdsa
320 + IdentityFile /var/lib/munin/.ssh/id_rsa
321 + EOF
322 +
323 + fowners munin:munin /var/lib/munin/.ssh/{,config}
324 + fperms go-rwx /var/lib/munin/.ssh/{,config}
325 +
326 + dodir /usr/share/${PN}
327 + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF
328 + # Force the shell to bash
329 + SHELL=/bin/bash
330 + # Mail reports to root@, not munin@
331 + MAILTO=root
332 +
333 + # This runs the munin task every 5 minutes.
334 + */5 * * * * /usr/bin/munin-cron
335 +
336 + # Alternatively, this route works differently
337 + # Update once a minute (for busy sites)
338 + #*/1 * * * * /usr/libexec/munin/munin-update
339 + ## Check for limit excess every 2 minutes
340 + #*/2 * * * * /usr/libexec/munin/munin-limits
341 + ## Update graphs every 5 minutes
342 + #*/5 * * * * nice /usr/libexec/munin/munin-graph
343 + ## Update HTML pages every 15 minutes
344 + #*/15 * * * * nice /usr/libexec/munin/munin-html
345 + EOF
346 +
347 + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF
348 + # Mail reports to root@, not munin@, only execute one at a time
349 + !mailto(root),serial(true)
350 +
351 + # This runs the munin task every 5 minutes.
352 + @ 5 /usr/bin/munin-cron
353 +
354 + # Alternatively, this route works differently
355 + # Update once a minute (for busy sites)
356 + #@ 1 /usr/libexec/munin/munin-update
357 + ## Check for limit excess every 2 minutes
358 + #@ 2 /usr/libexec/munin/munin-limits
359 + ## Update graphs every 5 minutes
360 + #@ 5 nice /usr/libexec/munin/munin-graph
361 + ## Update HTML pages every 15 minutes
362 + #@ 15 nice /usr/libexec/munin/munin-html
363 + EOF
364 +
365 + # remove .htaccess file
366 + find "${D}" -name .htaccess -delete || die
367 + fi
368 +}
369 +
370 +pkg_config() {
371 + if use minimal; then
372 + einfo "Nothing to do."
373 + return 0
374 + fi
375 +
376 + einfo "Press enter to install the default crontab for the munin master"
377 + einfo "installation from /usr/share/${PN}/f?crontab"
378 + einfo "If you have a large site, you may wish to customize it."
379 + read
380 +
381 + ebegin "Setting up cron ..."
382 + if has_version sys-process/fcron; then
383 + fcrontab - -u munin < /usr/share/${PN}/fcrontab
384 + else
385 + # dcron is very fussy about syntax
386 + # the following is the only form that works in BOTH dcron and vixie-cron
387 + crontab - -u munin < /usr/share/${PN}/crontab
388 + fi
389 + eend $?
390 +
391 + einfo "Press enter to set up the SSH keys used for SSH transport"
392 + read
393 +
394 + # generate one rsa (for legacy) and one ecdsa (for new systems)
395 + ssh-keygen -t rsa \
396 + -f /var/lib/munin/.ssh/id_rsa -N '' \
397 + -C "created by portage for ${CATEGORY}/${PN}" || die
398 + ssh-keygen -t ecdsa \
399 + -f /var/lib/munin/.ssh/id_ecdsa -N '' \
400 + -C "created by portage for ${CATEGORY}/${PN}" || die
401 + chown -R munin:munin /var/lib/munin/.ssh || die
402 + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die
403 +
404 + einfo "Your public keys are available in "
405 + einfo " /var/lib/munin/.ssh/id_rsa.pub"
406 + einfo " /var/lib/munin/.ssh/id_ecdsa.pub"
407 + einfo "and follows for convenience"
408 + echo
409 + cat /var/lib/munin/.ssh/id_*.pub
410 +}
411 +
412 +pkg_postinst() {
413 + elog "Please follow the munin documentation to set up the plugins you"
414 + elog "need, afterwards start munin-node."
415 + elog ""
416 + elog "To make use of munin-async, make sure to set up the corresponding"
417 + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys"
418 + elog ""
419 + if ! use minimal; then
420 + elog "Please run"
421 + elog " emerge --config net-analyzer/munin"
422 + elog "to automatically configure munin's cronjobs as well as generate"
423 + elog "passwordless SSH keys to be used with munin-async."
424 + fi
425 + elog ""
426 + elog "Further information about setting up Munin in Gentoo can be found"
427 + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
428 +
429 + if use cgi; then
430 + chown $(usex apache2 apache munin) \
431 + "${ROOT}"/var/cache/munin-cgi \
432 + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log
433 +
434 + if use apache2; then
435 + elog "To use Munin with CGI you should include /etc/apache2/vhosts.d/munin.include"
436 + elog "or /etc/apache2/vhosts.d/munin-2.4.include (for Apache 2.4) from the virtual"
437 + elog "host you want it to be served."
438 + elog "If you want to enable CGI-based HTML as well, you have to add to"
439 + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI."
440 + else
441 + elog "Effective CGI support has just been added in 2.0.7-r6."
442 + elog "Documentation on how to use it is still sparse."
443 + fi
444 + fi
445 +
446 + # we create this here as we don't want Portage to check /run
447 + # symlinks but we still need this to be present before the reboot.
448 + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then
449 + mkdir "${ROOT}"/run/munin
450 + chown munin:munin "${ROOT}"/run/munin
451 + chmod 0700 "${ROOT}"/run/munin
452 + fi
453 +}