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: munin-2.0.5-r2.ebuild ChangeLog munin-1.4.7-r2.ebuild
Date: Thu, 23 Aug 2012 19:20:57
Message-Id: 20120823192042.91E78204B1@flycatcher.gentoo.org
1 flameeyes 12/08/23 19:20:42
2
3 Modified: ChangeLog
4 Added: munin-2.0.5-r2.ebuild
5 Removed: munin-1.4.7-r2.ebuild
6 Log:
7 Remove old; revision bump: implement munin-asyncd support properly with an init script that drops privilege and a separate role uid to run on; pkg_config also generates SSH keys for the munin user for SSH transport support.
8
9 (Portage version: 2.2.0_alpha121/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.96 net-analyzer/munin/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?rev=1.96&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?rev=1.96&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/ChangeLog?r1=1.95&r2=1.96
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v
21 retrieving revision 1.95
22 retrieving revision 1.96
23 diff -u -r1.95 -r1.96
24 --- ChangeLog 19 Aug 2012 03:25:14 -0000 1.95
25 +++ ChangeLog 23 Aug 2012 19:20:42 -0000 1.96
26 @@ -1,6 +1,15 @@
27 # ChangeLog for net-analyzer/munin
28 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.95 2012/08/19 03:25:14 flameeyes Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.96 2012/08/23 19:20:42 flameeyes Exp $
31 +
32 +*munin-2.0.5-r2 (23 Aug 2012)
33 +
34 + 23 Aug 2012; Diego E. Pettenò <flameeyes@g.o>
35 + +files/munin-asyncd.init.2, +files/munin-node_init.d_2.0.5,
36 + +munin-2.0.5-r2.ebuild, -munin-1.4.7-r2.ebuild:
37 + Remove old; revision bump: implement munin-asyncd support properly with an
38 + init script that drops privilege and a separate role uid to run on; pkg_config
39 + also generates SSH keys for the munin user for SSH transport support.
40
41 19 Aug 2012; Diego E. Pettenò <flameeyes@g.o> metadata.xml:
42 Change herd to sysadmin.
43
44
45
46 1.1 net-analyzer/munin/munin-2.0.5-r2.ebuild
47
48 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/munin-2.0.5-r2.ebuild?rev=1.1&view=markup
49 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/munin/munin-2.0.5-r2.ebuild?rev=1.1&content-type=text/plain
50
51 Index: munin-2.0.5-r2.ebuild
52 ===================================================================
53 # Copyright 1999-2012 Gentoo Foundation
54 # Distributed under the terms of the GNU General Public License v2
55 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/munin-2.0.5-r2.ebuild,v 1.1 2012/08/23 19:20:42 flameeyes Exp $
56
57 EAPI=4
58
59 PATCHSET=3
60
61 inherit eutils user java-pkg-opt-2
62
63 MY_P=${P/_/-}
64
65 DESCRIPTION="Munin Server Monitoring Tool"
66 HOMEPAGE="http://munin-monitoring.org/"
67 SRC_URI="mirror://sourceforge/munin/${MY_P}.tar.gz
68 http://dev.gentoo.org/~flameeyes/${PN}/${P}-patches-${PATCHSET}.tar.xz"
69
70 LICENSE="GPL-2"
71 SLOT="0"
72 KEYWORDS="~amd64 ~mips ~ppc ~x86"
73 IUSE="asterisk irc java memcached minimal mysql postgres ssl test cgi ipv6 syslog ipmi http"
74 REQUIRED_USE="cgi? ( !minimal )"
75
76 # Upstream's listing of required modules is NOT correct!
77 # Some of the postgres plugins use DBD::Pg, while others call psql directly.
78 # Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
79 # We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
80 DEPEND_COM="dev-lang/perl
81 sys-process/procps
82 asterisk? ( dev-perl/Net-Telnet )
83 irc? ( dev-perl/Net-IRC )
84 mysql? ( virtual/mysql
85 dev-perl/Cache-Cache
86 dev-perl/DBD-mysql )
87 ssl? ( dev-perl/Net-SSLeay )
88 postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base )
89 memcached? ( dev-perl/Cache-Memcached )
90 cgi? ( dev-perl/FCGI )
91 syslog? ( virtual/perl-Sys-Syslog )
92 ipmi? (
93 >=sys-libs/freeipmi-1.1.6-r1
94 virtual/awk
95 )
96 http? ( dev-perl/libwww-perl )
97 dev-perl/DBI
98 dev-perl/DateManip
99 dev-perl/File-Copy-Recursive
100 dev-perl/Log-Log4perl
101 dev-perl/Net-CIDR
102 dev-perl/Net-Netmask
103 dev-perl/Net-SNMP
104 dev-perl/net-server[ipv6(-)?]
105 virtual/perl-Digest-MD5
106 virtual/perl-Getopt-Long
107 virtual/perl-MIME-Base64
108 virtual/perl-Storable
109 virtual/perl-Text-Balanced
110 virtual/perl-Time-HiRes
111 !minimal? (
112 dev-perl/HTML-Template
113 dev-perl/IO-Socket-INET6
114 >=net-analyzer/rrdtool-1.3[perl]
115 )"
116
117 # Keep this seperate, as previous versions have had other deps here
118 DEPEND="${DEPEND_COM}
119 virtual/perl-Module-Build
120 java? ( >=virtual/jdk-1.5 )
121 test? (
122 dev-perl/Test-LongString
123 dev-perl/Test-Differences
124 dev-perl/Test-MockModule
125 dev-perl/File-Slurp
126 dev-perl/IO-stringy
127 dev-perl/IO-Socket-INET6
128 )"
129 RDEPEND="${DEPEND_COM}
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
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/true /var/lib/munin-async
145 java-pkg-opt-2_pkg_setup
146 }
147
148 src_prepare() {
149 epatch "${WORKDIR}"/patches/*.patch
150
151 java-pkg-opt-2_src_prepare
152 }
153
154 src_configure() {
155 local cgidir='$(DESTDIR)/var/www/localhost/cgi-bin'
156 use cgi || cgidir="${T}/useless/cgi-bin"
157
158 cat - >> "${S}"/Makefile.config <<EOF
159 PREFIX=\$(DESTDIR)/usr
160 CONFDIR=\$(DESTDIR)/etc/munin
161 DOCDIR=${T}/useless/doc
162 MANDIR=\$(PREFIX)/share/man
163 LIBDIR=\$(PREFIX)/libexec/munin
164 HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
165 CGIDIR=${cgidir}
166 DBDIR=\$(DESTDIR)/var/lib/munin
167 SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
168 LOGDIR=\$(DESTDIR)/var/log/munin
169 PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
170 JCVALID=$(usex java yes no)
171 EOF
172 }
173
174 # parallel make and install need to be fixed before, and I haven't
175 # gotten around to do so yet.
176 src_compile() {
177 emake -j1
178 }
179
180 src_install() {
181 local dirs="
182 /var/log/munin
183 /var/lib/munin/plugin-state
184 /etc/munin/plugin-conf.d
185 /etc/munin/plugins"
186 keepdir ${dirs}
187 fowners munin:munin ${dirs}
188
189 local install_targets="install-common-prime install-node-prime install-plugins-prime"
190 use java && install_targets+=" install-plugins-java"
191
192 use minimal || install_targets=install
193 use minimal || dirs+=" /etc/munin/munin-conf.d/"
194
195 # parallel install doesn't work and it's also pointless to have this
196 # run in parallel for now (because it uses internal loops).
197 emake -j1 DESTDIR="${D}" ${install_targets}
198
199 # remove the plugins for non-Gentoo package managers
200 rm "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
201
202 insinto /etc/munin/plugin-conf.d/
203 newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
204
205 newinitd "${FILESDIR}"/munin-node_init.d_2.0.5 munin-node
206 newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
207
208 newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd
209
210 dodoc README ChangeLog INSTALL build/resources/apache*
211
212 # bug 254968
213 insinto /etc/logrotate.d/
214 newins "${FILESDIR}"/logrotate.d-munin munin
215
216 dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
217
218 if use syslog; then
219 sed -i -e '/log_file/s| .*| Sys::Syslog|' \
220 "${D}"/etc/munin/munin-node.conf || die
221 fi
222
223 keepdir /var/lib/munin-async/.ssh /var/spool/munin-async
224 touch "${D}"/var/lib/munin-async/.ssh/authorized_keys
225 fowners munin-async /var/lib/munin-async/.ssh/{,authorized_keys}
226 fperms 0700 /var/lib/munin-async/.ssh /var/spool/munin-async
227 fperms 0600 /var/lib/munin-async/.ssh/authorized_keys
228
229 if use minimal; then
230 # This requires the presence of munin-update, which is part of
231 # the non-minimal install...
232 rm "${D}"/usr/libexec/munin/plugins/munin_stats
233 else
234 exeinto /etc/local.d/
235 newexe "${FILESDIR}"/localstart-munin 50munin.start
236
237 # remove font files so that we don't have to keep them around
238 rm "${D}"/usr/libexec/${PN}/*.ttf || die
239
240 if use cgi; then
241 sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
242 else
243 sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${D}"/etc/munin/munin.conf || die
244 fi
245
246 keepdir /var/lib/munin/.ssh
247 cat - >> "${D}"/var/lib/munin/.ssh/config <<EOF
248 IdentityFile /var/lib/munin/.ssh/id_ecdsa
249 IdentityFile /var/lib/munin/.ssh/id_rsa
250 EOF
251
252 fperms go-rwx /var/lib/munin/.ssh/{,config}
253
254 dodir /usr/share/${PN}
255 cat - >> "${D}"/usr/share/${PN}/crontab <<EOF
256 # Force the shell to bash
257 SHELL=/bin/bash
258 # Mail reports to root@, not munin@
259 MAILTO=root
260
261 # This runs the munin task every 5 minutes.
262 */5 * * * * /usr/bin/munin-cron
263
264 # Alternatively, this route works differently
265 # Update once a minute (for busy sites)
266 #*/1 * * * * /usr/libexec/munin/munin-update
267 ## Check for limit excess every 2 minutes
268 #*/2 * * * * /usr/libexec/munin/munin-limits
269 ## Update graphs every 5 minutes
270 #*/5 * * * * nice /usr/libexec/munin/munin-graph
271 ## Update HTML pages every 15 minutes
272 #*/15 * * * * nice /usr/libexec/munin/munin-html
273 EOF
274
275 cat - >> "${D}"/usr/share/${PN}/fcrontab <<EOF
276 # Mail reports to root@, not munin@, only execute one at a time
277 !mailto(root),serial(true)
278
279 # This runs the munin task every 5 minutes.
280 @ 5 /usr/bin/munin-cron
281
282 # Alternatively, this route works differently
283 # Update once a minute (for busy sites)
284 #@ 1 /usr/libexec/munin/munin-update
285 ## Check for limit excess every 2 minutes
286 #@ 2 /usr/libexec/munin/munin-limits
287 ## Update graphs every 5 minutes
288 #@ 5 nice /usr/libexec/munin/munin-graph
289 ## Update HTML pages every 15 minutes
290 #@ 15 nice /usr/libexec/munin/munin-html
291 EOF
292
293 # remove .htaccess file
294 find "${D}" -name .htaccess -delete || die
295 fi
296 }
297
298 pkg_config() {
299 if use minimal; then
300 einfo "Nothing to do."
301 return 0
302 fi
303
304 einfo "Press enter to install the default crontab for the munin master"
305 einfo "installation from /usr/share/${PN}/f?crontab"
306 einfo "If you have a large site, you may wish to customize it."
307 read
308
309 ebegin "Setting up cron ..."
310 if has_version sys-process/fcron; then
311 fcrontab - -u munin < /usr/share/${PN}/fcrontab
312 else
313 # dcron is very fussy about syntax
314 # the following is the only form that works in BOTH dcron and vixie-cron
315 crontab - -u munin < /usr/share/${PN}/crontab
316 fi
317 eend $?
318
319 einfo "Press enter to set up the SSH keys used for SSH transport"
320 read
321
322 # generate one rsa (for legacy) and one ecdsa (for new systems)
323 ssh-keygen -t rsa -f /var/lib/munin/.ssh/id_rsa -N '' -C "created by portage for ${CATEGORY}/${PN}" || die
324 ssh-keygen -t ecdsa -f /var/lib/munin/.ssh/id_ecdsa -N '' -C "created by portage for ${CATEGORY}/${PN}" || die
325 chown -R munin:munin /var/lib/munin/.ssh || die
326 chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die
327
328 einfo "Your public keys are available in "
329 einfo " /var/lib/munin/.ssh/id_rsa.pub"
330 einfo " /var/lib/munin/.ssh/id_ecdsa.pub"
331 einfo "and follows for convenience"
332 echo
333 cat /var/lib/munin/.ssh/id_*.pub
334 }
335
336 pkg_postinst() {
337 elog "Please follow the munin documentation to set up the plugins you"
338 elog "need, afterwards start munin-node via /etc/init.d/munin-node."
339 elog ""
340 elog "To make use of munin-async, make sure to set up the corresponding"
341 elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys"
342 elog ""
343 if ! use minimal; then
344 elog "Please run"
345 elog " emerge --config net-analyzer/munin"
346 elog "to automatically configure munin's cronjobs as well as generate"
347 elog "passwordless SSH keys to be used with munin-async."
348 fi
349 elog ""
350 elog "Further information about setting up Munin in Gentoo can be found"
351 elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
352 }