1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit eutils linux-info toolchain-funcs
9 DESCRIPTION="Blocks connections from/to hosts listed in a file in peerguardian format using iptables"
10 HOMEPAGE="http://moblock.berlios.de/"
11 SRC_URI="mirror://berlios/${PN}/${MY_P}-i586.tar.bz2"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="logrotate network-cron"
18 DEPEND="net-libs/libnetfilter_queue
19 net-libs/libnfnetlink"
22 logrotate? ( app-admin/logrotate )"
26 CONFIG_CHECK="NETFILTER NETFILTER_XTABLES NETFILTER_XT_TARGET_NFQUEUE
27 IP_NF_IPTABLES IP_NF_FILTER NETFILTER_XT_MATCH_STATE"
31 epatch "${FILESDIR}"/${P}-{makefile,rename-stats-file,fix-nfq_unbind_pf-error,fix-broken-compile}.patch
35 emake CC=$(tc-getCC) || die "emake failed"
39 dosbin "${FILESDIR}/${PVR}/"moblock-{update,stats} moblock || die
41 newinitd "${FILESDIR}/${PVR}/init.d" moblock || die
42 doconfd "${FILESDIR}/${PVR}/"moblock.{paranoid,normal,minimal}.example || die
43 newconfd "${FILESDIR}/${PVR}/moblock.normal.example" moblock || die
45 dodir /var/{db,cache}/moblock || die
46 touch "${D}/var/db/moblock/guarding.p2p" || die
48 if use network-cron; then
49 dosym /usr/sbin/moblock-update /etc/cron.weekly/moblock-update || die
52 if use logrotate; then
53 insinto /etc/logrotate.d || die
54 newins "${FILESDIR}/${PVR}/logrotate" moblock || die
57 dodoc Changelog README || die
61 if use network-cron; then
62 elog "The script /usr/sbin/moblock-update will be run weekly to update your"
63 elog "blocklists. You can change this by moving or removing the symlink"
64 elog "/etc/cron.weekly/moblock-update or re-installing MoBlock without the"
65 elog "network-cron USE flag."
67 elog "Run moblock-update to update your block list. To have this happen"
68 elog "automatically, re-install enabling the network-cron USE flag."
71 elog "You can view or change your blocklist(s) and other options by editing"
72 elog "/etc/conf.d/moblock. Example configuration files are also in /etc/conf.d/."
76 if ! [[ -e ${ROOT}/usr/sbin/moblock ]] && [[ -d ${ROOT}/var/cache/moblock ]] ; then
77 elog "Removing leftover cache..."
78 rm -rf "${ROOT}/var/cache/moblock" ||
79 ewarn "Failed to remove ${ROOT}/var/cache/moblock"