Gentoo Archives: gentoo-commits

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