/[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.6 - (show annotations) (download)
Wed Dec 12 09:45:08 2012 UTC (16 months ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +1 -1 lines
FILE REMOVED
Remove old version; bump to 2.0.9, adding missing test dependencies and avoiding install of /var/run; restrict tests on the current stable as some dependencies are missing.

(Portage version: 2.2.0_alpha148/cvs/Linux x86_64, signed Manifest commit with key 1CD13C8AD4301342)

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

  ViewVC Help
Powered by ViewVC 1.1.20