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