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