# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/smokeping/smokeping-2.4.2.ebuild,v 1.3 2009/03/07 12:57:43 armin76 Exp $ EAPI="2" inherit perl-module eutils DESCRIPTION="A powerful latency measurement tool." HOMEPAGE="http://oss.oetiker.ch/smokeping/" SRC_URI="http://oss.oetiker.ch/smokeping/pub/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~hppa ~sparc ~x86" IUSE="apache2 speedy" DEPEND="dev-lang/perl virtual/perl-libnet >=net-analyzer/rrdtool-1.2[perl] >=net-analyzer/fping-2.4_beta2-r2 dev-perl/Digest-HMAC dev-perl/libwww-perl dev-perl/Socket6 dev-perl/Net-DNS speedy? ( dev-perl/SpeedyCGI ) !apache2? ( virtual/httpd-cgi ) apache2? ( >=www-apache/mod_perl-2.0.1 )" RDEPEND="${DEPEND}" pkg_preinst() { enewgroup smokeping enewuser smokeping -1 -1 /var/lib/smokeping smokeping } src_unpack() { # perl-mod.eclass does not support EAPI=2. unpack ${A} } src_prepare() { # we depend on dev-perl/Digest-HMAC. No need for bundled version. rm -rf lib/Digest rm qooxdoo/qooxdoolink } src_compile() { # There is a makefile we don't want to run so leave this here einfo "Skip compile." } src_install() { # First move all the perl modules into the vendor lib area of Perl perlinfo insinto ${VENDOR_LIB}/ doins -r lib/* # Install the CGI webserver scripts sed 's:^use lib:#use lib:g' -i htdocs/*.cgi.dist if use speedy; then sed '1{s:/usr/[^ ]*:/usr/bin/speedy:}' -i htdocs/*.cgi.dist else sed '1{s:/usr/[^ ]*:/usr/bin/perl:}' -i htdocs/*.cgi.dist fi sed 's:/home/oetiker.*/config.dist:/etc/smokeping/config:' \ -i htdocs/*.cgi.dist exeinto /var/www/localhost/perl/ newexe htdocs/smokeping.cgi.dist smokeping.pl || die exeinto /var/www/localhost/smokeping newexe htdocs/tr.cgi.dist tr.cgi || die rm htdocs/{tr,smokeping}.cgi.dist # Install AJAX scripts insinto /var/www/localhost/smokeping doins -r htdocs/* || die # Create the smokeping binaries for bin in ${PN} tSmoke; do newbin bin/${bin}.dist ${bin} dosed 's:^use lib:#use lib:g' /usr/bin/${bin} dosed 's:etc/config.dist:/etc/smokeping/config:' /usr/bin/${bin} done # Create the config files insinto /etc/${PN} for file in etc/*; do config=${file/.dist} newins ${file} ${config#*/} done sed -e '/^imgcache/{s:\(^imgcache[ \t]*=\).*:\1 /var/lib/smokeping/.simg:}' \ -e '/^imgurl/{s:\(^imgurl[ \t]*=\).*:\1 ../.simg:}' \ -e '/^datadir/{s:\(^datadir[ \t]*=\).*:\1 /var/lib/smokeping:}' \ -e '/^piddir/{s:\(^piddir[ \t]*=\).*:\1 /var/run/smokeping:}' \ -e '/^cgiurl/{s#\(^cgiurl[ \t]*=\).*#\1 http://some.place.xyz/perl/smokeping.pl#}' \ -e '/^smokemail/{s:\(^smokemail[ \t]*=\).*:\1 /etc/smokeping/smokemail:}' \ -e '/^tmail/{s:\(^tmail[ \t]*=\).*:\1 /etc/smokeping/tmail:}' \ -e '/^secrets/{s:\(^secrets[ \t]*=\).*:\1 /etc/smokeping/smokeping_secrets:}' \ -e '/^template/{s:\(^template[ \t]*=\).*:\1 /etc/smokeping/basepage.html:}' \ -i "${D}/etc/${PN}/config" || die sed -e '/^