| 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.2.ebuild,v 1.5 2012/07/20 18:10:54 flameeyes Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
PATCHSET=7
|
| 8 |
|
| 9 |
inherit eutils user versionator 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.bz2"
|
| 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"
|
| 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 |
DEPEND_COM="dev-lang/perl
|
| 28 |
sys-process/procps
|
| 29 |
asterisk? ( dev-perl/Net-Telnet )
|
| 30 |
irc? ( dev-perl/Net-IRC )
|
| 31 |
mysql? ( virtual/mysql
|
| 32 |
dev-perl/Cache-Cache
|
| 33 |
dev-perl/DBD-mysql )
|
| 34 |
ssl? ( dev-perl/Net-SSLeay )
|
| 35 |
postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base )
|
| 36 |
memcached? ( dev-perl/Cache-Memcached )
|
| 37 |
cgi? ( dev-perl/FCGI )
|
| 38 |
dev-perl/DateManip
|
| 39 |
dev-perl/File-Copy-Recursive
|
| 40 |
dev-perl/IO-Socket-INET6
|
| 41 |
dev-perl/Net-CIDR
|
| 42 |
dev-perl/Net-Netmask
|
| 43 |
dev-perl/Net-SNMP
|
| 44 |
dev-perl/libwww-perl
|
| 45 |
dev-perl/net-server
|
| 46 |
dev-perl/DBI
|
| 47 |
dev-perl/Log-Log4perl
|
| 48 |
virtual/perl-Digest-MD5
|
| 49 |
virtual/perl-Getopt-Long
|
| 50 |
virtual/perl-MIME-Base64
|
| 51 |
virtual/perl-Storable
|
| 52 |
virtual/perl-Text-Balanced
|
| 53 |
virtual/perl-Time-HiRes
|
| 54 |
!minimal? ( dev-perl/HTML-Template
|
| 55 |
>=net-analyzer/rrdtool-1.3[perl] )"
|
| 56 |
|
| 57 |
# Keep this seperate, as previous versions have had other deps here
|
| 58 |
DEPEND="${DEPEND_COM}
|
| 59 |
virtual/perl-Module-Build
|
| 60 |
java? ( >=virtual/jdk-1.5 )
|
| 61 |
test? (
|
| 62 |
dev-perl/Test-LongString
|
| 63 |
dev-perl/Test-Differences
|
| 64 |
dev-perl/Test-MockModule
|
| 65 |
dev-perl/File-Slurp
|
| 66 |
dev-perl/IO-stringy
|
| 67 |
)"
|
| 68 |
RDEPEND="${DEPEND_COM}
|
| 69 |
java? ( >=virtual/jre-1.5 )
|
| 70 |
!minimal? (
|
| 71 |
virtual/cron
|
| 72 |
media-fonts/dejavu
|
| 73 |
)"
|
| 74 |
|
| 75 |
S="${WORKDIR}/${MY_P}"
|
| 76 |
|
| 77 |
pkg_setup() {
|
| 78 |
enewgroup munin
|
| 79 |
enewuser munin 177 -1 /var/lib/munin munin
|
| 80 |
java-pkg-opt-2_pkg_setup
|
| 81 |
}
|
| 82 |
|
| 83 |
src_prepare() {
|
| 84 |
epatch "${WORKDIR}"/patches/*.patch
|
| 85 |
java-pkg-opt-2_src_prepare
|
| 86 |
}
|
| 87 |
|
| 88 |
src_configure() {
|
| 89 |
local cgidir='$(DESTDIR)/var/www/localhost/cgi-bin'
|
| 90 |
use cgi || cgidir="${T}/useless/cgi-bin"
|
| 91 |
|
| 92 |
cat - >> "${S}"/Makefile.config <<EOF
|
| 93 |
PREFIX=\$(DESTDIR)/usr
|
| 94 |
CONFDIR=\$(DESTDIR)/etc/munin
|
| 95 |
DOCDIR=${T}/useless/doc
|
| 96 |
MANDIR=\$(PREFIX)/share/man
|
| 97 |
LIBDIR=\$(PREFIX)/libexec/munin
|
| 98 |
HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
|
| 99 |
CGIDIR=${cgidir}
|
| 100 |
DBDIR=\$(DESTDIR)/var/lib/munin
|
| 101 |
LOGDIR=\$(DESTDIR)/var/log/munin
|
| 102 |
PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
|
| 103 |
JCVALID=$(usex java yes no)
|
| 104 |
EOF
|
| 105 |
}
|
| 106 |
src_install() {
|
| 107 |
local dirs
|
| 108 |
dirs="/var/log/munin/ /var/lib/munin/"
|
| 109 |
dirs="${dirs} /var/lib/munin/plugin-state/"
|
| 110 |
dirs="${dirs} /etc/munin/plugin-conf.d/"
|
| 111 |
dirs="${dirs} /etc/munin/munin-conf.d/"
|
| 112 |
dirs="${dirs} /etc/munin/plugins/"
|
| 113 |
keepdir ${dirs}
|
| 114 |
|
| 115 |
local install_targets="install-common-prime install-node-prime install-plugins-prime"
|
| 116 |
use java && install_targets+=" install-plugins-java"
|
| 117 |
use minimal || install_targets=install
|
| 118 |
|
| 119 |
# parallel install doesn't work and it's also pointless to have this
|
| 120 |
# run in parallel for now (because it uses internal loops).
|
| 121 |
emake -j1 DESTDIR="${D}" ${install_targets}
|
| 122 |
fowners munin:munin ${dirs}
|
| 123 |
|
| 124 |
insinto /etc/munin/plugin-conf.d/
|
| 125 |
newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
|
| 126 |
|
| 127 |
# make sure we've got everything in the correct directory
|
| 128 |
insinto /var/lib/munin
|
| 129 |
newins "${FILESDIR}"/${PN}-1.3.3-crontab crontab
|
| 130 |
newinitd "${FILESDIR}"/munin-node_init.d_2.0.2 munin-node
|
| 131 |
newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
|
| 132 |
dodoc README ChangeLog INSTALL build/resources/apache*
|
| 133 |
|
| 134 |
# bug 254968
|
| 135 |
insinto /etc/logrotate.d/
|
| 136 |
newins "${FILESDIR}"/logrotate.d-munin munin
|
| 137 |
|
| 138 |
if ! use minimal; then
|
| 139 |
exeinto /etc/local.d/
|
| 140 |
newexe "${FILESDIR}"/localstart-munin 50munin.start
|
| 141 |
|
| 142 |
# remove font files so that we don't have to keep them around
|
| 143 |
rm "${D}"/usr/libexec/${PN}/*.ttf || die
|
| 144 |
fi
|
| 145 |
}
|
| 146 |
|
| 147 |
pkg_config() {
|
| 148 |
einfo "Press enter to install the default crontab for the munin master"
|
| 149 |
einfo "installation from /var/lib/munin/crontab"
|
| 150 |
einfo "If you have a large site, you may wish to customize it."
|
| 151 |
read
|
| 152 |
# dcron is very fussy about syntax
|
| 153 |
# the following is the only form that works in BOTH dcron and vixie-cron
|
| 154 |
crontab - -u munin </var/lib/munin/crontab
|
| 155 |
}
|
| 156 |
|
| 157 |
pkg_postinst() {
|
| 158 |
elog
|
| 159 |
if ! use minimal; then
|
| 160 |
elog "To have munin's cronjob automatically configured for you if this is"
|
| 161 |
elog "your munin master installation, please:"
|
| 162 |
elog "emerge --config net-analyzer/munin"
|
| 163 |
fi
|
| 164 |
}
|