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

Contents of /net-analyzer/munin/munin-2.0.4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Jul 30 15:16:43 2012 UTC (2 years ago) by flameeyes
Branch: MAIN
Version bump; this version includes most of the previously applied patches, but gets rid of freeipmi_ as a separate plugin (now it takes the place of ipmi_ itself).

(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.3-r1.ebuild,v 1.1 2012/07/29 03:53:20 flameeyes Exp $
4    
5     EAPI=4
6    
7     PATCHSET=3
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 plugisn 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? ( >=virtual/jre-1.5 )
79     !minimal? (
80     virtual/cron
81     media-fonts/dejavu
82     )"
83    
84     S="${WORKDIR}/${MY_P}"
85    
86     pkg_setup() {
87     enewgroup munin
88     enewuser munin 177 -1 /var/lib/munin munin
89     java-pkg-opt-2_pkg_setup
90     }
91    
92     src_prepare() {
93     epatch "${WORKDIR}"/patches/*.patch
94    
95     java-pkg-opt-2_src_prepare
96     }
97    
98     src_configure() {
99     local cgidir='$(DESTDIR)/var/www/localhost/cgi-bin'
100     use cgi || cgidir="${T}/useless/cgi-bin"
101    
102     cat - >> "${S}"/Makefile.config <<EOF
103     PREFIX=\$(DESTDIR)/usr
104     CONFDIR=\$(DESTDIR)/etc/munin
105     DOCDIR=${T}/useless/doc
106     MANDIR=\$(PREFIX)/share/man
107     LIBDIR=\$(PREFIX)/libexec/munin
108     HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
109     CGIDIR=${cgidir}
110     DBDIR=\$(DESTDIR)/var/lib/munin
111     LOGDIR=\$(DESTDIR)/var/log/munin
112     PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
113     JCVALID=$(usex java yes no)
114     EOF
115     }
116    
117     # parallel make and install need to be fixed before, and I haven't
118     # gotten around to do so yet.
119     src_compile() {
120     emake -j1
121     }
122    
123     src_install() {
124     local dirs="
125     /var/log/munin/
126     /var/lib/munin/plugin-state/
127     /etc/munin/plugin-conf.d/
128     /etc/munin/plugins/"
129     keepdir ${dirs}
130     fowners munin:munin ${dirs}
131     use minimal || dirs+=" /etc/munin/munin-conf.d/"
132    
133     local install_targets="install-common-prime install-node-prime install-plugins-prime"
134     use java && install_targets+=" install-plugins-java"
135     use minimal || install_targets=install
136    
137     # parallel install doesn't work and it's also pointless to have this
138     # run in parallel for now (because it uses internal loops).
139     emake -j1 DESTDIR="${D}" ${install_targets}
140    
141     # remove the plugins for non-Gentoo package managers
142     rm "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
143    
144     insinto /etc/munin/plugin-conf.d/
145     newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
146    
147     # make sure we've got everything in the correct directory
148     newinitd "${FILESDIR}"/munin-node_init.d_2.0.2 munin-node
149     newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
150     dodoc README ChangeLog INSTALL build/resources/apache*
151    
152     # bug 254968
153     insinto /etc/logrotate.d/
154     newins "${FILESDIR}"/logrotate.d-munin munin
155    
156     dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
157    
158     if use syslog; then
159     sed -i -e '/log_file/s| .*| Sys::Syslog|' \
160     "${D}"/etc/munin/munin-node.conf || die
161     fi
162    
163     if ! use minimal; then
164     exeinto /etc/local.d/
165     newexe "${FILESDIR}"/localstart-munin 50munin.start
166    
167     # remove font files so that we don't have to keep them around
168     rm "${D}"/usr/libexec/${PN}/*.ttf || die
169    
170     if use cgi; then
171     sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
172     else
173     sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${D}"/etc/munin/munin.conf || die
174     fi
175    
176     dodir /usr/share/${PN}
177     cat - >> "${D}"/usr/share/${PN}/crontab <<EOF
178     # Force the shell to bash
179     SHELL=/bin/bash
180     # Mail reports to root@, not munin@
181     MAILTO=root
182    
183     # This runs the munin task every 5 minutes.
184     */5 * * * * /usr/bin/munin-cron
185    
186     # Alternatively, this route works differently
187     # Update once a minute (for busy sites)
188     #*/1 * * * * /usr/libexec/munin/munin-update
189     ## Check for limit excess every 2 minutes
190     #*/2 * * * * /usr/libexec/munin/munin-limits
191     ## Update graphs every 5 minutes
192     #*/5 * * * * nice /usr/libexec/munin/munin-graph
193     ## Update HTML pages every 15 minutes
194     #*/15 * * * * nice /usr/libexec/munin/munin-html
195     EOF
196    
197     cat - >> "${D}"/usr/share/${PN}/fcrontab <<EOF
198     # Mail reports to root@, not munin@, only execute one at a time
199     !mailto(root),serial(true)
200    
201     # This runs the munin task every 5 minutes.
202     @ 5 /usr/bin/munin-cron
203    
204     # Alternatively, this route works differently
205     # Update once a minute (for busy sites)
206     #@ 1 /usr/libexec/munin/munin-update
207     ## Check for limit excess every 2 minutes
208     #@ 2 /usr/libexec/munin/munin-limits
209     ## Update graphs every 5 minutes
210     #@ 5 nice /usr/libexec/munin/munin-graph
211     ## Update HTML pages every 15 minutes
212     #@ 15 nice /usr/libexec/munin/munin-html
213     EOF
214    
215     # remove .htaccess file
216     find "${D}" -name .htaccess -delete || die
217     fi
218     }
219    
220     pkg_config() {
221     if use minimal; then
222     einfo "Nothing to do."
223     return 0
224     fi
225    
226     einfo "Press enter to install the default crontab for the munin master"
227     einfo "installation from /usr/share/${PN}/f?crontab"
228     einfo "If you have a large site, you may wish to customize it."
229     read
230    
231     if has_version sys-process/fcron; then
232     fcrontab - -u munin < /usr/share/${PN}/fcrontab
233     else
234     # dcron is very fussy about syntax
235     # the following is the only form that works in BOTH dcron and vixie-cron
236     crontab - -u munin < /usr/share/${PN}/crontab
237     fi
238     }
239    
240     pkg_postinst() {
241     elog "Please follow the munin documentation to set up the plugins you"
242     elog "need, afterwards start munin-node via /etc/init.d/munin-node."
243     if ! use minimal; then
244     elog "To have munin's cronjob automatically configured for you if this is"
245     elog "your munin master installation, please:"
246     elog "emerge --config net-analyzer/munin"
247     fi
248     elog ""
249     elog "Further information about setting up Munin in Gentoo can be found"
250     elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
251     }

  ViewVC Help
Powered by ViewVC 1.1.20