/[gentoo-x86]/net-analyzer/munin/munin-2.0.5-r1.ebuild
Gentoo

Contents of /net-analyzer/munin/munin-2.0.5-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Fri Aug 17 15:24:27 2012 UTC (2 years, 2 months ago) by flameeyes
Branch: MAIN
Improvement related to node autoconfiguration: depend on netcat if java is enabled (required for JMX's autoconfiguration); drop munin_stats if not installing master; update patches to fix autoconf for more plugins.

(Portage version: 2.2.0_alpha120/cvs/Linux x86_64)

1 flameeyes 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/munin-2.0.5.ebuild,v 1.2 2012/08/14 21:45:35 flameeyes Exp $
4    
5     EAPI=4
6    
7     PATCHSET=2
8    
9     inherit eutils user java-pkg-opt-2
10    
11     MY_P=${P/_/-}
12    
13     DESCRIPTION="Munin Server Monitoring Tool"
14     HOMEPAGE="http://munin-monitoring.org/"
15     SRC_URI="mirror://sourceforge/munin/${MY_P}.tar.gz
16     http://dev.gentoo.org/~flameeyes/${PN}/${P}-patches-${PATCHSET}.tar.xz"
17    
18     LICENSE="GPL-2"
19     SLOT="0"
20     KEYWORDS="~amd64 ~mips ~x86"
21     IUSE="asterisk irc java memcached minimal mysql postgres ssl test cgi ipv6 syslog ipmi http"
22     REQUIRED_USE="cgi? ( !minimal )"
23    
24     # Upstream's listing of required modules is NOT correct!
25     # Some of the postgres plugins use DBD::Pg, while others call psql directly.
26     # Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
27     # We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
28     DEPEND_COM="dev-lang/perl
29     sys-process/procps
30     asterisk? ( dev-perl/Net-Telnet )
31     irc? ( dev-perl/Net-IRC )
32     mysql? ( virtual/mysql
33     dev-perl/Cache-Cache
34     dev-perl/DBD-mysql )
35     ssl? ( dev-perl/Net-SSLeay )
36     postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base )
37     memcached? ( dev-perl/Cache-Memcached )
38     cgi? ( dev-perl/FCGI )
39     syslog? ( virtual/perl-Sys-Syslog )
40     ipmi? (
41     >=sys-libs/freeipmi-1.1.6-r1
42     virtual/awk
43     )
44     http? ( dev-perl/libwww-perl )
45     dev-perl/DBI
46     dev-perl/DateManip
47     dev-perl/File-Copy-Recursive
48     dev-perl/Log-Log4perl
49     dev-perl/Net-CIDR
50     dev-perl/Net-Netmask
51     dev-perl/Net-SNMP
52     dev-perl/net-server[ipv6(-)?]
53     virtual/perl-Digest-MD5
54     virtual/perl-Getopt-Long
55     virtual/perl-MIME-Base64
56     virtual/perl-Storable
57     virtual/perl-Text-Balanced
58     virtual/perl-Time-HiRes
59     !minimal? (
60     dev-perl/HTML-Template
61     dev-perl/IO-Socket-INET6
62     >=net-analyzer/rrdtool-1.3[perl]
63     )"
64    
65     # Keep this seperate, as previous versions have had other deps here
66     DEPEND="${DEPEND_COM}
67     virtual/perl-Module-Build
68     java? ( >=virtual/jdk-1.5 )
69     test? (
70     dev-perl/Test-LongString
71     dev-perl/Test-Differences
72     dev-perl/Test-MockModule
73     dev-perl/File-Slurp
74     dev-perl/IO-stringy
75     dev-perl/IO-Socket-INET6
76     )"
77     RDEPEND="${DEPEND_COM}
78     java? (
79     >=virtual/jre-1.5
80     || ( net-analyzer/netcat6 net-analyzer/netcat )
81     )
82     !minimal? (
83     virtual/cron
84     media-fonts/dejavu
85     )"
86    
87     S="${WORKDIR}/${MY_P}"
88    
89     pkg_setup() {
90     enewgroup munin
91     enewuser munin 177 -1 /var/lib/munin munin
92     java-pkg-opt-2_pkg_setup
93     }
94    
95     src_prepare() {
96     epatch "${WORKDIR}"/patches/*.patch
97    
98     java-pkg-opt-2_src_prepare
99     }
100    
101     src_configure() {
102     local cgidir='$(DESTDIR)/var/www/localhost/cgi-bin'
103     use cgi || cgidir="${T}/useless/cgi-bin"
104    
105     cat - >> "${S}"/Makefile.config <<EOF
106     PREFIX=\$(DESTDIR)/usr
107     CONFDIR=\$(DESTDIR)/etc/munin
108     DOCDIR=${T}/useless/doc
109     MANDIR=\$(PREFIX)/share/man
110     LIBDIR=\$(PREFIX)/libexec/munin
111     HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
112     CGIDIR=${cgidir}
113     DBDIR=\$(DESTDIR)/var/lib/munin
114     SPOOLDIR=\$(DESTDIR)/var/spool/munin
115     LOGDIR=\$(DESTDIR)/var/log/munin
116     PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
117     JCVALID=$(usex java yes no)
118     EOF
119     }
120    
121     # parallel make and install need to be fixed before, and I haven't
122     # gotten around to do so yet.
123     src_compile() {
124     emake -j1
125     }
126    
127     src_install() {
128     local dirs="
129     /var/log/munin/
130     /var/lib/munin/plugin-state/
131     /var/spool/munin/
132     /etc/munin/plugin-conf.d/
133     /etc/munin/plugins/"
134     keepdir ${dirs}
135     fowners munin:munin ${dirs}
136    
137     local install_targets="install-common-prime install-node-prime install-plugins-prime"
138     use java && install_targets+=" install-plugins-java"
139    
140     use minimal || install_targets=install
141     use minimal || dirs+=" /etc/munin/munin-conf.d/"
142    
143     # parallel install doesn't work and it's also pointless to have this
144     # run in parallel for now (because it uses internal loops).
145     emake -j1 DESTDIR="${D}" ${install_targets}
146    
147     # remove the plugins for non-Gentoo package managers
148     rm "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
149    
150     insinto /etc/munin/plugin-conf.d/
151     newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
152    
153     newinitd "${FILESDIR}"/munin-node_init.d_2.0.2 munin-node
154     newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
155    
156     newinitd "${FILESDIR}"/munin-asyncd.init munin-asyncd
157    
158     dodoc README ChangeLog INSTALL build/resources/apache*
159    
160     # bug 254968
161     insinto /etc/logrotate.d/
162     newins "${FILESDIR}"/logrotate.d-munin munin
163    
164     dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
165    
166     if use syslog; then
167     sed -i -e '/log_file/s| .*| Sys::Syslog|' \
168     "${D}"/etc/munin/munin-node.conf || die
169     fi
170    
171     if use minimal; then
172     # This requires the presence of munin-update, which is part of
173     # the non-minimal install...
174     rm "${D}"/usr/libexec/munin/plugins/munin_stats
175     else
176     exeinto /etc/local.d/
177     newexe "${FILESDIR}"/localstart-munin 50munin.start
178    
179     # remove font files so that we don't have to keep them around
180     rm "${D}"/usr/libexec/${PN}/*.ttf || die
181    
182     if use cgi; then
183     sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
184     else
185     sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${D}"/etc/munin/munin.conf || die
186     fi
187    
188     dodir /usr/share/${PN}
189     cat - >> "${D}"/usr/share/${PN}/crontab <<EOF
190     # Force the shell to bash
191     SHELL=/bin/bash
192     # Mail reports to root@, not munin@
193     MAILTO=root
194    
195     # This runs the munin task every 5 minutes.
196     */5 * * * * /usr/bin/munin-cron
197    
198     # Alternatively, this route works differently
199     # Update once a minute (for busy sites)
200     #*/1 * * * * /usr/libexec/munin/munin-update
201     ## Check for limit excess every 2 minutes
202     #*/2 * * * * /usr/libexec/munin/munin-limits
203     ## Update graphs every 5 minutes
204     #*/5 * * * * nice /usr/libexec/munin/munin-graph
205     ## Update HTML pages every 15 minutes
206     #*/15 * * * * nice /usr/libexec/munin/munin-html
207     EOF
208    
209     cat - >> "${D}"/usr/share/${PN}/fcrontab <<EOF
210     # Mail reports to root@, not munin@, only execute one at a time
211     !mailto(root),serial(true)
212    
213     # This runs the munin task every 5 minutes.
214     @ 5 /usr/bin/munin-cron
215    
216     # Alternatively, this route works differently
217     # Update once a minute (for busy sites)
218     #@ 1 /usr/libexec/munin/munin-update
219     ## Check for limit excess every 2 minutes
220     #@ 2 /usr/libexec/munin/munin-limits
221     ## Update graphs every 5 minutes
222     #@ 5 nice /usr/libexec/munin/munin-graph
223     ## Update HTML pages every 15 minutes
224     #@ 15 nice /usr/libexec/munin/munin-html
225     EOF
226    
227     # remove .htaccess file
228     find "${D}" -name .htaccess -delete || die
229     fi
230     }
231    
232     pkg_config() {
233     if use minimal; then
234     einfo "Nothing to do."
235     return 0
236     fi
237    
238     einfo "Press enter to install the default crontab for the munin master"
239     einfo "installation from /usr/share/${PN}/f?crontab"
240     einfo "If you have a large site, you may wish to customize it."
241     read
242    
243     if has_version sys-process/fcron; then
244     fcrontab - -u munin < /usr/share/${PN}/fcrontab
245     else
246     # dcron is very fussy about syntax
247     # the following is the only form that works in BOTH dcron and vixie-cron
248     crontab - -u munin < /usr/share/${PN}/crontab
249     fi
250     }
251    
252     pkg_postinst() {
253     elog "Please follow the munin documentation to set up the plugins you"
254     elog "need, afterwards start munin-node via /etc/init.d/munin-node."
255     if ! use minimal; then
256     elog "To have munin's cronjob automatically configured for you if this is"
257     elog "your munin master installation, please:"
258     elog "emerge --config net-analyzer/munin"
259     fi
260     elog ""
261     elog "Further information about setting up Munin in Gentoo can be found"
262     elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
263     }

  ViewVC Help
Powered by ViewVC 1.1.20