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