# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils IUSE="apache2" DESCRIPTION="LinuxStat is for generating and displaying different statistics" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" HOMEPAGE="http://lstat.sourceforge.net/" DEPEND="dev-lang/perl net-analyzer/rrdtool" RDEPEND="${DEPEND} net-www/apache apache2? ( >=dev-perl/mod_perl-1.99 ) !apache2? ( dev-perl/mod_perl ) dev-perl/CGI" SLOT="0" LICENSE="GPL-2" KEYWORDS="~x86 ~sparc" #Standard location for Gentoo Linux DATADIR="/var/www/localhost" src_unpack() { unpack ${A} cd ${S} epatch ${FILESDIR}/${PN}-makefile.patch epatch ${FILESDIR}/${PN}-gentoo.patch epatch ${FILESDIR}/${PN}-conf_in.patch } src_compile() { myconf="" use apache2 && myconf="--mod_perl2" || myconf="--mod_perl1" perl ./configure \ --apache \ --with-httpdconf="/etc/apache2/conf/modules.d/" \ --with-prefix="/usr/share/${PN}" \ --with-bin="/usr/bin" \ --with-etc="/etc/${PN}" \ --with-www="${DATADIR}/${PN}" \ --with-pages="/var/lib/${PN}/pages" \ --with-objects="/var/lib/${PN}/objects" \ --with-templates="/var/lib/${PN}/templates" \ --with-wwwuser=apache \ --with-wwwgroup=apache \ --noupdate_apache_conf \ ${myconf} || die "configure failed" make || die "make failed" } src_install() { einstall DESTDIR=${D} || die "make install failed" # some cleaning rm -f ${D}/usr/bin/lstatd.rc ${D}/usr/bin/lstatd dosbin ${S}/src/lstatd # keep some dirs keepdir /var/lib/lstat/objects keepdir /etc/lstat/rrd keepdir /var/www/localhost/lstat/statimg keepdir /var/lib/lstat/templates/plugins/en keepdir /var/lib/lstat/templates/plugins/pl fowners apache:apache /var/lib/lstat/pages/user.config* # gentoo init script insinto /etc/conf.d; newins ${FILESDIR}/${PN}.conf "${PN}d" exeinto /etc/init.d; newexe ${FILESDIR}/${PN}.init "${PN}d" } pkg_postinst() { echo einfo "In order to read lstat config by apache," einfo "you have to restart it (apache)" echo einfo "Tweak permisions for viewing statistics by" einfo "running security_lstat" echo einfo "Run /etc/init.d/lstatd to start counting statistics." echo }