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, 01 May 2020 04:58:47
Message-Id: 1588309117.b2ca940373f55e1a50abb9aa711748da94dbb97e.graaff@gentoo
1 commit: b2ca940373f55e1a50abb9aa711748da94dbb97e
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 1 04:56:31 2020 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Fri May 1 04:58:37 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2ca9403
7
8 net-analyzer/munin: add 2.0.61
9
10 Package-Manager: Portage-2.3.89, Repoman-2.3.20
11 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
12
13 net-analyzer/munin/Manifest | 2 +
14 net-analyzer/munin/munin-2.0.61.ebuild | 417 +++++++++++++++++++++++++++++++++
15 2 files changed, 419 insertions(+)
16
17 diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest
18 index c99159b3c8c..afd8481757c 100644
19 --- a/net-analyzer/munin/Manifest
20 +++ b/net-analyzer/munin/Manifest
21 @@ -6,3 +6,5 @@ DIST munin-2.0.57-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051
22 DIST munin-2.0.57.tar.gz 2272894 BLAKE2B 8daff79d4c9224d83ea91d4583a1c11cdc0d2de05c536da5717cf31555f1d2c87475e4de541688e4b542267a6b8a534911149a7edd6469bd13de79838fae3aed SHA512 d00cfaf450dc4be5fe52f30440fc14ee49f021fe46c1a641ffd2e60682056051b6b2fc8713bd14ae9f9e5aaf28dbf335b6a2e9ec53f8518178888442c069298c
23 DIST munin-2.0.59-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051a7f3a5dc8250776ab6ae1659197d795dfb87274db66ff0a3deb4e10e14ced5b3765551a3f29357c436968a848f450ea SHA512 b21d6590bb9e1da127066a06818f1f3157362762f80526e2231b926956959e62af575f38235f72326376dc21bba63f9767efa379f1f2558ca9b20ddf5395e851
24 DIST munin-2.0.59.tar.gz 2276011 BLAKE2B 0681cd838daaa056418258d473825642e2aa6b7a3ac7a435859033a467351145be73df327d3149b46c53f5a04c602bea57bc5af428cafb7b5bf1e9c780915ddf SHA512 5597db797f7a0de3581a17be13b079a3fd1e50903014d67d81a262e921fdfca84eee8ec65e3927438db0e01525d16faaabc7e3f7d4cad1a73e7e14002b10478f
25 +DIST munin-2.0.61-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051a7f3a5dc8250776ab6ae1659197d795dfb87274db66ff0a3deb4e10e14ced5b3765551a3f29357c436968a848f450ea SHA512 b21d6590bb9e1da127066a06818f1f3157362762f80526e2231b926956959e62af575f38235f72326376dc21bba63f9767efa379f1f2558ca9b20ddf5395e851
26 +DIST munin-2.0.61.tar.gz 2254571 BLAKE2B e73fb6fc4f71c8d56a7e8a05852f699c94a7cf321b8034ad31ccbd06a37a602e6d312c0079fcb31afc5489a265a35a68c037743e01471ca950223d5cb6757b64 SHA512 ea6ae5a7f812985e0179dc2fe2f21136ecf6152ec2adf48d53e4fa19cfc14e74befe56c77a18f27ba966c12034a4fea442d5d1498a7cfe57ed052d332c199019
27
28 diff --git a/net-analyzer/munin/munin-2.0.61.ebuild b/net-analyzer/munin/munin-2.0.61.ebuild
29 new file mode 100644
30 index 00000000000..b111ae5e6fd
31 --- /dev/null
32 +++ b/net-analyzer/munin/munin-2.0.61.ebuild
33 @@ -0,0 +1,417 @@
34 +# Copyright 1999-2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +PATCHSET=1
40 +
41 +inherit java-pkg-opt-2 systemd
42 +
43 +MY_P=${P/_/-}
44 +
45 +DESCRIPTION="Munin Server Monitoring Tool"
46 +HOMEPAGE="http://munin-monitoring.org/"
47 +SRC_URI="
48 + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz
49 + https://dev.gentoo.org/~graaff/munin/${P}-gentoo-${PATCHSET}.tar.xz"
50 +
51 +LICENSE="GPL-2"
52 +SLOT="0"
53 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
54 +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2"
55 +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )"
56 +RESTRICT="!test? ( test )"
57 +
58 +# Upstream's listing of required modules is NOT correct!
59 +# Some of the postgres plugins use DBD::Pg, while others call psql directly.
60 +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
61 +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
62 +DEPEND_COM="
63 + acct-user/munin
64 + acct-user/munin-async
65 + acct-group/munin
66 + dev-lang/perl:=[berkdb]
67 + dev-perl/DBI
68 + dev-perl/Date-Manip
69 + dev-perl/File-Copy-Recursive
70 + dev-perl/List-MoreUtils
71 + dev-perl/Log-Log4perl
72 + dev-perl/Net-CIDR
73 + dev-perl/Net-DNS
74 + dev-perl/Net-Netmask
75 + dev-perl/Net-SNMP
76 + dev-perl/Net-Server[ipv6(-)?]
77 + virtual/perl-Digest-MD5
78 + virtual/perl-Getopt-Long
79 + virtual/perl-MIME-Base64
80 + virtual/perl-Storable
81 + virtual/perl-Text-Balanced
82 + virtual/perl-Time-HiRes
83 + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] )
84 + asterisk? ( dev-perl/Net-Telnet )
85 + cgi? (
86 + dev-perl/FCGI
87 + dev-perl/CGI-Fast
88 + )
89 + dhcpd? (
90 + >=net-misc/dhcp-3[server]
91 + dev-perl/Net-IP
92 + dev-perl/HTTP-Date
93 + )
94 + doc? ( dev-python/sphinx )
95 + http? ( dev-perl/libwww-perl )
96 + irc? ( dev-perl/Net-IRC )
97 + ldap? ( dev-perl/perl-ldap )
98 + kernel_linux? ( sys-process/procps )
99 + memcached? ( dev-perl/Cache-Memcached )
100 + mysql? (
101 + virtual/mysql
102 + dev-perl/Cache-Cache
103 + dev-perl/DBD-mysql
104 + )
105 + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* )
106 + ssl? ( dev-perl/Net-SSLeay )
107 + syslog? ( virtual/perl-Sys-Syslog )
108 + !minimal? (
109 + dev-perl/HTML-Template
110 + dev-perl/IO-Socket-INET6
111 + dev-perl/URI
112 + >=net-analyzer/rrdtool-1.3[graph,perl]
113 + virtual/ssh
114 + )
115 + "
116 +
117 +# Keep this seperate, as previous versions have had other deps here
118 +DEPEND="${DEPEND_COM}
119 + dev-perl/Module-Build
120 + java? ( >=virtual/jdk-1.5 )
121 + test? (
122 + dev-perl/Test-Deep
123 + dev-perl/Test-Exception
124 + dev-perl/Test-LongString
125 + dev-perl/Test-Differences
126 + dev-perl/Test-MockModule
127 + dev-perl/Test-MockObject
128 + dev-perl/File-Slurp
129 + dev-perl/IO-stringy
130 + dev-perl/IO-Socket-INET6
131 + )"
132 +RDEPEND="${DEPEND_COM}
133 + virtual/awk
134 + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 )
135 + java? (
136 + >=virtual/jre-1.5
137 + || ( net-analyzer/netcat net-analyzer/openbsd-netcat )
138 + )
139 + !minimal? (
140 + virtual/cron
141 + media-fonts/dejavu
142 + )
143 + selinux? ( sec-policy/selinux-munin )"
144 +
145 +S="${WORKDIR}/${MY_P}"
146 +
147 +pkg_setup() {
148 + java-pkg-opt-2_pkg_setup
149 +}
150 +
151 +src_prepare() {
152 + echo ${PV} > RELEASE || die
153 +
154 + eapply "${WORKDIR}"/patches/*.patch
155 +
156 + eapply_user
157 +
158 + java-pkg-opt-2_src_prepare
159 +}
160 +
161 +src_configure() {
162 + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi'
163 + use cgi || cgidir="${T}/useless/cgi-bin"
164 +
165 + local cgiuser=$(usex apache2 apache munin)
166 +
167 + cat >> "${S}"/Makefile.config <<- EOF
168 + PREFIX=\$(DESTDIR)/usr
169 + CONFDIR=\$(DESTDIR)/etc/munin
170 + DOCDIR=${T}/useless/doc
171 + MANDIR=\$(PREFIX)/share/man
172 + LIBDIR=\$(PREFIX)/libexec/munin
173 + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
174 + CGIDIR=${cgidir}
175 + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi
176 + CGIUSER=${cgiuser}
177 + DBDIR=\$(DESTDIR)/var/lib/munin
178 + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node
179 + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
180 + LOGDIR=\$(DESTDIR)/var/log/munin
181 + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2)
182 + JCVALID=$(usex java yes no)
183 + STATEDIR=\$(DESTDIR)/run/munin
184 + EOF
185 +}
186 +
187 +# parallel make and install need to be fixed before, and I haven't
188 +# gotten around to do so yet.
189 +src_compile() {
190 + emake -j1
191 + use doc && emake -C doc html
192 +}
193 +
194 +src_test() {
195 + if [[ ${EUID} == 0 ]]; then
196 + eerror "You cannot run tests as root."
197 + eerror "Please enable FEATURES=userpriv before proceeding."
198 + return 1
199 + fi
200 +
201 + local testtargets="test-common test-node test-plugins"
202 + use minimal || testtargets+=" test-master"
203 +
204 + LC_ALL=C emake -j1 ${testtargets}
205 +}
206 +
207 +src_install() {
208 + local dirs="
209 + /var/log/munin
210 + /var/lib/munin/plugin-state
211 + /var/lib/munin-node/plugin-state
212 + /var/www/localhost/htdocs/munin
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 CHOWN=true 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 +}