# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="Reactive Autonomous Blackhole List server" HOMEPAGE="http://www.nuclearelephant.com/projects/rabl/" SRC_URI="http://www.nuclearelephant.com/projects/rabl/sources/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="debug" DEPEND="" RDEPEND="" pkg_setup() { id rabl 2>/dev/null || enewgroup rabl id rabl 2>/dev/null || enewuser rabl -1 -1 /var/spool/rabl rabl } src_unpack() { unpack ${A} cd ${S} epatch ${FILESDIR}/${PN}-dns-reload.patch || die "patch failed" } src_compile() { local myconf cd "${S}" myconf="${myconf} --prefix=/usr" myconf="${myconf} --sysconfdir=/etc/${PN}" use debug && myconf="${myconf} --enable-debug" econf ${myconf} || die "econf failed" emake } src_install() { cd "${S}" # Replace the BSD ipf stuff with iptables sed -i "s:^\(DoSCMD[\t ]*\"\).*:\1iptables -I INPUT -s %s/32 -p all -j DROP\":gI" \ rabl_server.conf # Change path to BIND zone files if [ -d "${ROOT}/var/bind/pri" ]; then sed -i "s:/var/named/rabl\.:/var/bind/pri/rabl.:gI" \ rabl_server.conf fi # Change the default password for RW access sed -i "s:^\(User[\t ]*00001[\t ]*\)[a-z]*\([\t ]*\*[\t ]*RW.*\)$:\1${RANDOM}${RANDOM}${RANDOM}${RANDOM}\2:gI" \ rabl_server.conf # Change the default log to /var/log/rabl_server.log sed -i "s:^\(LogFile[\t ]*\).*:\1/var/log/rabl.log:gI" \ rabl_server.conf # RABL data in /var/spool/rabl diropts -m0775 -o rabl -g rabl dodir /var/spool/rabl keepdir /var/spool/rabl make DESTDIR="${D}" install || die "Install failed" insinto /etc/${PN} doins rabl_server.conf dodoc README RELEASE.NOTES CHANGE dodoc ${FILESDIR}/rabl.mydomain.com.template dodoc ${FILESDIR}/README.BIND newconfd ${FILESDIR}/confd ${PN} newinitd ${FILESDIR}/initd ${PN} } pkg_postinst() { einfo "edit /etc/conf.d/${PN}" }