summaryrefslogtreecommitdiff
blob: e03119cf4c2dc0e67a6b3431ba113a55fc285c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils toolchain-funcs linux-info

KEYWORDS="~amd64 ~x86"

MY_P=${P/mob/MoB}

DESCRIPTION="Blocks connections from/to hosts listed in a file in peerguardian format using iptables."
HOMEPAGE="http://moblock.berlios.de/"
SRC_URI="mirror://berlios/${PN}/${MY_P}-i586.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
IUSE=""

DEPEND=">=net-libs/libnetfilter_queue-0.0.11
		>=net-libs/libnfnetlink-0.0.14
		net-firewall/iptables"
RDEPEND="${DEPEND}"

S=${WORKDIR}/${MY_P}

CONFIG_CHECK="NETFILTER NETFILTER_XTABLES NETFILTER_XT_TARGET_NFQUEUE IP_NF_IPTABLES IP_NF_FILTER"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/${P}-makefile.patch"
}

src_compile() {
	emake CC=$(tc-getCC) || die "emake failed"
}

src_install() {
	dosbin moblock
	dosbin "${FILESDIR}/${PVR}/moblock-update"
	dosbin "${FILESDIR}/${PVR}/moblock-stats"

	newconfd "${FILESDIR}/${PVR}/confd" moblock
	newinitd "${FILESDIR}/${PVR}/initd" moblock

	dodir /var/db/moblock
	touch "${D}/var/db/moblock/guarding.p2p"

	keepdir /var/cache/moblock

	dodoc Changelog README
}

pkg_postinst() {
	elog "Run moblock-update to update your block list."
	elog "You can set moblock to update daily with the command"
	elog "  ln -s /usr/sbin/moblock-update /etc/cron.daily/moblock-update"
	elog "Or weekly with"
	elog "  ln -s /usr/sbin/moblock-update /etc/cron.weekly/moblock-update"
}

pkg_postrm() {
	if [[ -d /var/cache/moblock ]] ; then
		einfo "Removing leftover cache..."
		rm -rf /var/cache/moblock
	fi
}