Gentoo Archives: gentoo-commits

From: "Pacho Ramos (pacho)" <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-analyzer/munin: munin-2.0.14-r1.ebuild ChangeLog
Date: Sat, 31 Aug 2013 07:35:20
Message-Id: 20130831073512.56B9A2004C@flycatcher.gentoo.org
1 pacho 13/08/31 07:35:12
2
3 Modified: ChangeLog
4 Added: munin-2.0.14-r1.ebuild
5 Log:
6 Add unit files (#478164 by Justin Lecher)
7
8 (Portage version: 2.2.1/cvs/Linux x86_64, signed Manifest commit with key A188FBD4)
9
10 Revision Changes Path
11 1.144 net-analyzer/munin/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?rev=1.144&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?rev=1.144&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?r1=1.143&r2=1.144
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v
20 retrieving revision 1.143
21 retrieving revision 1.144
22 diff -u -r1.143 -r1.144
23 --- ChangeLog 11 Jun 2013 19:08:25 -0000 1.143
24 +++ ChangeLog 31 Aug 2013 07:35:12 -0000 1.144
25 @@ -1,6 +1,14 @@
26 # ChangeLog for net-analyzer/munin
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.143 2013/06/11 19:08:25 maekke Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.144 2013/08/31 07:35:12 pacho Exp $
30 +
31 +*munin-2.0.14-r1 (31 Aug 2013)
32 +
33 + 31 Aug 2013; Pacho Ramos <pacho@g.o> +files/munin-async.service,
34 + +files/munin-graph.service, +files/munin-graph.socket,
35 + +files/munin-html.service, +files/munin-html.socket,
36 + +files/munin-node.service, +munin-2.0.14-r1.ebuild:
37 + Add unit files (#478164 by Justin Lecher)
38
39 11 Jun 2013; Markus Meier <maekke@g.o> munin-2.0.14.ebuild:
40 add ~arm, bug #446958
41
42
43
44 1.1 net-analyzer/munin/munin-2.0.14-r1.ebuild
45
46 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/munin-2.0.14-r1.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/munin-2.0.14-r1.ebuild?rev=1.1&content-type=text/plain
48
49 Index: munin-2.0.14-r1.ebuild
50 ===================================================================
51 # Copyright 1999-2013 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/munin-2.0.14-r1.ebuild,v 1.1 2013/08/31 07:35:12 pacho Exp $
54
55 EAPI=5
56
57 PATCHSET=1
58
59 inherit eutils user java-pkg-opt-2 systemd
60
61 MY_P=${P/_/-}
62
63 DESCRIPTION="Munin Server Monitoring Tool"
64 HOMEPAGE="http://munin-monitoring.org/"
65 SRC_URI="mirror://sourceforge/munin/${MY_P}.tar.gz
66 http://dev.gentoo.org/~flameeyes/${PN}/${P}-gentoo-${PATCHSET}.tar.xz"
67
68 LICENSE="GPL-2"
69 SLOT="0"
70 KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
71 IUSE="asterisk irc java memcached minimal mysql postgres ssl test cgi ipv6 syslog ipmi http dhcpd doc apache"
72 REQUIRED_USE="cgi? ( !minimal ) apache? ( cgi )"
73
74 # Upstream's listing of required modules is NOT correct!
75 # Some of the postgres plugins use DBD::Pg, while others call psql directly.
76 # Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
77 # We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
78 DEPEND_COM="dev-lang/perl[berkdb]
79 kernel_linux? ( sys-process/procps )
80 doc? ( dev-python/sphinx )
81 asterisk? ( dev-perl/Net-Telnet )
82 irc? ( dev-perl/Net-IRC )
83 mysql? ( virtual/mysql
84 dev-perl/Cache-Cache
85 dev-perl/DBD-mysql )
86 ssl? ( dev-perl/Net-SSLeay )
87 postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base )
88 memcached? ( dev-perl/Cache-Memcached )
89 cgi? ( dev-perl/FCGI )
90 apache? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] )
91 syslog? ( virtual/perl-Sys-Syslog )
92 http? ( dev-perl/libwww-perl )
93 dhcpd? (
94 >=net-misc/dhcp-3[server]
95 dev-perl/Net-IP
96 dev-perl/HTTP-Date
97 )
98 dev-perl/DBI
99 dev-perl/DateManip
100 dev-perl/File-Copy-Recursive
101 dev-perl/List-MoreUtils
102 dev-perl/Log-Log4perl
103 dev-perl/Net-CIDR
104 dev-perl/Net-Netmask
105 dev-perl/Net-SNMP
106 dev-perl/net-server[ipv6(-)?]
107 virtual/perl-Digest-MD5
108 virtual/perl-Getopt-Long
109 virtual/perl-MIME-Base64
110 virtual/perl-Storable
111 virtual/perl-Text-Balanced
112 virtual/perl-Time-HiRes
113 !minimal? (
114 dev-perl/HTML-Template
115 dev-perl/IO-Socket-INET6
116 dev-perl/URI
117 >=net-analyzer/rrdtool-1.3[perl]
118 virtual/ssh
119 )"
120
121 # Keep this seperate, as previous versions have had other deps here
122 DEPEND="${DEPEND_COM}
123 virtual/perl-Module-Build
124 java? ( >=virtual/jdk-1.5 )
125 test? (
126 dev-perl/Test-Deep
127 dev-perl/Test-LongString
128 dev-perl/Test-Differences
129 dev-perl/Test-MockModule
130 dev-perl/Test-MockObject
131 dev-perl/File-Slurp
132 dev-perl/IO-stringy
133 dev-perl/IO-Socket-INET6
134 )"
135 RDEPEND="${DEPEND_COM}
136 virtual/awk
137 ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 )
138 java? (
139 >=virtual/jre-1.5
140 || ( net-analyzer/netcat6 net-analyzer/netcat )
141 )
142 !minimal? (
143 virtual/cron
144 media-fonts/dejavu
145 )
146 !<sys-apps/openrc-0.11.8"
147
148 S="${WORKDIR}/${MY_P}"
149
150 pkg_setup() {
151 enewgroup munin
152 enewuser munin 177 -1 /var/lib/munin munin
153 enewuser munin-async -1 /bin/sh /var/spool/munin-async
154 esethome munin-async /var/spool/munin-async
155 java-pkg-opt-2_pkg_setup
156 }
157
158 src_prepare() {
159 epatch "${WORKDIR}"/patches/*.patch
160
161 java-pkg-opt-2_src_prepare
162 }
163
164 src_configure() {
165 local cgidir='$(DESTDIR)/usr/libexec/munin/cgi'
166 use cgi || cgidir="${T}/useless/cgi-bin"
167
168 local cgiuser=$(usex apache apache munin)
169
170 cat - >> "${S}"/Makefile.config <<EOF
171 PREFIX=\$(DESTDIR)/usr
172 CONFDIR=\$(DESTDIR)/etc/munin
173 DOCDIR=${T}/useless/doc
174 MANDIR=\$(PREFIX)/share/man
175 LIBDIR=\$(PREFIX)/libexec/munin
176 HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
177 CGIDIR=${cgidir}
178 CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi
179 CGIUSER=${cgiuser}
180 DBDIR=\$(DESTDIR)/var/lib/munin
181 DBDIRNODE=\$(DESTDIR)/var/lib/munin-node
182 SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
183 LOGDIR=\$(DESTDIR)/var/log/munin
184 PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
185 JCVALID=$(usex java yes no)
186 STATEDIR=\$(DESTDIR)/run/munin
187 EOF
188 }
189
190 # parallel make and install need to be fixed before, and I haven't
191 # gotten around to do so yet.
192 src_compile() {
193 emake -j1
194 if use doc; then
195 emake -C doc html
196 fi
197 }
198
199 src_test() {
200 if [[ ${EUID} == 0 ]]; then
201 eerror "You cannot run tests as root."
202 eerror "Please enable FEATURES=userpriv before proceeding."
203 return 1
204 fi
205
206 local testtargets="test-common test-node test-plugins"
207 use minimal || testtargets+=" test-master"
208
209 LC_ALL=C emake -j1 ${testtargets}
210 }
211
212 src_install() {
213 local dirs="
214 /var/log/munin
215 /var/lib/munin/plugin-state
216 /etc/munin/plugin-conf.d
217 /etc/munin/plugins"
218 use minimal || dirs+=" /etc/munin/munin-conf.d/"
219
220 keepdir ${dirs}
221 fowners munin:munin ${dirs}
222
223 # parallel install doesn't work and it's also pointless to have this
224 # run in parallel for now (because it uses internal loops).
225 emake -j1 DESTDIR="${D}" $(usex minimal install-minimal install)
226
227 # we remove /run from the install, as it's not the package's to deal
228 # with.
229 rm -rf "${D}"/run
230
231 # remove the plugins for non-Gentoo package managers; use -f so that
232 # it doesn't fail when installing on non-Linux platforms.
233 rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
234
235 insinto /etc/munin/plugin-conf.d/
236 newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
237
238 newinitd "${FILESDIR}"/munin-node_init.d_2.0.7 munin-node
239 newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
240
241 newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd
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
256 dohtml -r *
257 cd "${S}"
258 fi
259
260 dodir /etc/logrotate.d/
261 sed -e "s:@CGIUSER@:$(usex apache apache munin):g" \
262 "${FILESDIR}"/logrotate.d-munin.2 > "${D}"/etc/logrotate.d/munin
263
264 dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
265
266 if use syslog; then
267 sed -i -e '/log_file/s| .*| Sys::Syslog|' \
268 "${D}"/etc/munin/munin-node.conf || die
269 fi
270
271 # Use a simpler pid file to avoid trouble with /run in tmpfs. The
272 # munin-node service is ran as user root, and only later drops
273 # privileges.
274 sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \
275 "${D}"/etc/munin/munin-node.conf || die
276
277 keepdir /var/spool/munin-async/.ssh
278 touch "${D}"/var/spool/munin-async/.ssh/authorized_keys
279 fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}}
280 fperms 0750 /var/spool/munin-async{,/.ssh}
281 fperms 0600 /var/spool/munin-async/.ssh/authorized_keys
282
283 if use minimal; then
284 # This requires the presence of munin-update, which is part of
285 # the non-minimal install...
286 rm "${D}"/usr/libexec/munin/plugins/munin_stats
287 else
288 dodir /usr/lib/tmpfiles.d
289 cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
290 d /run/munin 0700 munin munin - -
291 EOF
292
293 # remove font files so that we don't have to keep them around
294 rm "${D}"/usr/libexec/${PN}/*.ttf || die
295
296 if use cgi; then
297 sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
298
299 keepdir /var/cache/munin-cgi
300 touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log
301 fowners $(usex apache apache munin) \
302 /var/cache/munin-cgi \
303 /var/log/munin/munin-cgi-{graph,html}.log
304
305 if use apache; then
306 insinto /etc/apache2/vhosts.d
307 newins "${FILESDIR}"/munin.apache.include munin.include
308 newins "${FILESDIR}"/munin.apache.include-2.4 munin-2.4.include
309 fi
310 else
311 sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${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 -f /var/lib/munin/.ssh/id_rsa -N '' -C "created by portage for ${CATEGORY}/${PN}" || die
393 ssh-keygen -t ecdsa -f /var/lib/munin/.ssh/id_ecdsa -N '' -C "created by portage for ${CATEGORY}/${PN}" || die
394 chown -R munin:munin /var/lib/munin/.ssh || die
395 chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die
396
397 einfo "Your public keys are available in "
398 einfo " /var/lib/munin/.ssh/id_rsa.pub"
399 einfo " /var/lib/munin/.ssh/id_ecdsa.pub"
400 einfo "and follows for convenience"
401 echo
402 cat /var/lib/munin/.ssh/id_*.pub
403 }
404
405 pkg_postinst() {
406 elog "Please follow the munin documentation to set up the plugins you"
407 elog "need, afterwards start munin-node."
408 elog ""
409 elog "To make use of munin-async, make sure to set up the corresponding"
410 elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys"
411 elog ""
412 if ! use minimal; then
413 elog "Please run"
414 elog " emerge --config net-analyzer/munin"
415 elog "to automatically configure munin's cronjobs as well as generate"
416 elog "passwordless SSH keys to be used with munin-async."
417 fi
418 elog ""
419 elog "Further information about setting up Munin in Gentoo can be found"
420 elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
421
422 if use cgi; then
423 chown $(usex apache apache munin) \
424 "${ROOT}"/var/cache/munin-cgi \
425 "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log
426
427 if use apache; then
428 elog "To use Munin with CGI you should include /etc/apache2/vhosts.d/munin.include"
429 elog "or /etc/apache2/vhosts.d/munin-2.4.include (for Apache 2.4) from the virtual"
430 elog "host you want it to be served."
431 elog "If you want to enable CGI-based HTML as well, you have to add to"
432 elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI."
433 else
434 elog "Effective CGI support has just been added in 2.0.7-r6."
435 elog "Documentation on how to use it is still sparse."
436 fi
437 fi
438
439 # we create this here as we don't want Portage to check /run
440 # symlinks but we still need this to be present before the reboot.
441 if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then
442 mkdir "${ROOT}"/run/munin
443 chown munin:munin "${ROOT}"/run/munin
444 chmod 0700 "${ROOT}"/run/munin
445 fi
446 }