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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Aug 17 15:24:27 2012 UTC (2 years, 8 months ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
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 # 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=1
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? ( >=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 SPOOLDIR=\$(DESTDIR)/var/spool/munin
112 LOGDIR=\$(DESTDIR)/var/log/munin
113 PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
114 JCVALID=$(usex java yes no)
115 EOF
116 }
117
118 # parallel make and install need to be fixed before, and I haven't
119 # gotten around to do so yet.
120 src_compile() {
121 emake -j1
122 }
123
124 src_install() {
125 local dirs="
126 /var/log/munin/
127 /var/lib/munin/plugin-state/
128 /var/spool/munin/
129 /etc/munin/plugin-conf.d/
130 /etc/munin/plugins/"
131 keepdir ${dirs}
132 fowners munin:munin ${dirs}
133 use minimal || dirs+=" /etc/munin/munin-conf.d/"
134
135 local install_targets="install-common-prime install-node-prime install-plugins-prime"
136 use java && install_targets+=" install-plugins-java"
137 use minimal || install_targets=install
138
139 # parallel install doesn't work and it's also pointless to have this
140 # run in parallel for now (because it uses internal loops).
141 emake -j1 DESTDIR="${D}" ${install_targets}
142
143 # remove the plugins for non-Gentoo package managers
144 rm "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
145
146 insinto /etc/munin/plugin-conf.d/
147 newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
148
149 newinitd "${FILESDIR}"/munin-node_init.d_2.0.2 munin-node
150 newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
151
152 newinitd "${FILESDIR}"/munin-asyncd.init munin-asyncd
153
154 dodoc README ChangeLog INSTALL build/resources/apache*
155
156 # bug 254968
157 insinto /etc/logrotate.d/
158 newins "${FILESDIR}"/logrotate.d-munin munin
159
160 dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
161
162 if use syslog; then
163 sed -i -e '/log_file/s| .*| Sys::Syslog|' \
164 "${D}"/etc/munin/munin-node.conf || die
165 fi
166
167 if ! use minimal; then
168 exeinto /etc/local.d/
169 newexe "${FILESDIR}"/localstart-munin 50munin.start
170
171 # remove font files so that we don't have to keep them around
172 rm "${D}"/usr/libexec/${PN}/*.ttf || die
173
174 if use cgi; then
175 sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
176 else
177 sed -i -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' "${D}"/etc/munin/munin.conf || die
178 fi
179
180 dodir /usr/share/${PN}
181 cat - >> "${D}"/usr/share/${PN}/crontab <<EOF
182 # Force the shell to bash
183 SHELL=/bin/bash
184 # Mail reports to root@, not munin@
185 MAILTO=root
186
187 # This runs the munin task every 5 minutes.
188 */5 * * * * /usr/bin/munin-cron
189
190 # Alternatively, this route works differently
191 # Update once a minute (for busy sites)
192 #*/1 * * * * /usr/libexec/munin/munin-update
193 ## Check for limit excess every 2 minutes
194 #*/2 * * * * /usr/libexec/munin/munin-limits
195 ## Update graphs every 5 minutes
196 #*/5 * * * * nice /usr/libexec/munin/munin-graph
197 ## Update HTML pages every 15 minutes
198 #*/15 * * * * nice /usr/libexec/munin/munin-html
199 EOF
200
201 cat - >> "${D}"/usr/share/${PN}/fcrontab <<EOF
202 # Mail reports to root@, not munin@, only execute one at a time
203 !mailto(root),serial(true)
204
205 # This runs the munin task every 5 minutes.
206 @ 5 /usr/bin/munin-cron
207
208 # Alternatively, this route works differently
209 # Update once a minute (for busy sites)
210 #@ 1 /usr/libexec/munin/munin-update
211 ## Check for limit excess every 2 minutes
212 #@ 2 /usr/libexec/munin/munin-limits
213 ## Update graphs every 5 minutes
214 #@ 5 nice /usr/libexec/munin/munin-graph
215 ## Update HTML pages every 15 minutes
216 #@ 15 nice /usr/libexec/munin/munin-html
217 EOF
218
219 # remove .htaccess file
220 find "${D}" -name .htaccess -delete || die
221 fi
222 }
223
224 pkg_config() {
225 if use minimal; then
226 einfo "Nothing to do."
227 return 0
228 fi
229
230 einfo "Press enter to install the default crontab for the munin master"
231 einfo "installation from /usr/share/${PN}/f?crontab"
232 einfo "If you have a large site, you may wish to customize it."
233 read
234
235 if has_version sys-process/fcron; then
236 fcrontab - -u munin < /usr/share/${PN}/fcrontab
237 else
238 # dcron is very fussy about syntax
239 # the following is the only form that works in BOTH dcron and vixie-cron
240 crontab - -u munin < /usr/share/${PN}/crontab
241 fi
242 }
243
244 pkg_postinst() {
245 elog "Please follow the munin documentation to set up the plugins you"
246 elog "need, afterwards start munin-node via /etc/init.d/munin-node."
247 if ! use minimal; then
248 elog "To have munin's cronjob automatically configured for you if this is"
249 elog "your munin master installation, please:"
250 elog "emerge --config net-analyzer/munin"
251 fi
252 elog ""
253 elog "Further information about setting up Munin in Gentoo can be found"
254 elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
255 }

  ViewVC Help
Powered by ViewVC 1.1.20