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