blob: b5e9a1a3468f0f3e134c5e79032ba3ea48984b9c (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils linux-info toolchain-funcs
MY_P=MoBlock-${PV}
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"
KEYWORDS="~amd64 ~x86"
IUSE="logrotate network-cron"
DEPEND="net-libs/libnetfilter_queue
net-libs/libnfnetlink"
RDEPEND="${DEPEND}
net-firewall/iptables
logrotate? ( app-admin/logrotate )"
S=${WORKDIR}/${MY_P}
CONFIG_CHECK="NETFILTER NETFILTER_XTABLES NETFILTER_XT_TARGET_NFQUEUE
IP_NF_IPTABLES IP_NF_FILTER NETFILTER_XT_MATCH_STATE"
src_unpack() {
unpack ${A}
epatch "${FILESDIR}"/${P}-{makefile,rename-stats-file,fix-nfq_unbind_pf-error,fix-broken-compile}.patch
}
src_compile() {
emake CC=$(tc-getCC) || die "emake failed"
}
src_install() {
dosbin "${FILESDIR}/${PVR}/"moblock-{update,stats} moblock || die
newinitd "${FILESDIR}/${PVR}/init.d" moblock || die
doconfd "${FILESDIR}/${PVR}/"moblock.{paranoid,normal,minimal}.example || die
newconfd "${FILESDIR}/${PVR}/moblock.normal.example" moblock || die
dodir /var/{db,cache}/moblock || die
touch "${D}/var/db/moblock/guarding.p2p" || die
if use network-cron; then
dosym /usr/sbin/moblock-update /etc/cron.weekly/moblock-update || die
fi
if use logrotate; then
insinto /etc/logrotate.d || die
newins "${FILESDIR}/${PVR}/logrotate" moblock || die
fi
dodoc Changelog README || die
}
pkg_postinst() {
if use network-cron; then
elog "The script /usr/sbin/moblock-update will be run weekly to update your"
elog "blocklists. You can change this by moving or removing the symlink"
elog "/etc/cron.weekly/moblock-update or re-installing MoBlock without the"
elog "network-cron USE flag."
else
elog "Run moblock-update to update your block list. To have this happen"
elog "automatically, re-install enabling the network-cron USE flag."
fi
elog ""
elog "You can view or change your blocklist(s) and other options by editing"
elog "/etc/conf.d/moblock. Example configuration files are also in /etc/conf.d/."
}
pkg_postrm() {
if ! [[ -e ${ROOT}/usr/sbin/moblock ]] && [[ -d ${ROOT}/var/cache/moblock ]] ; then
elog "Removing leftover cache..."
rm -rf "${ROOT}/var/cache/moblock" ||
ewarn "Failed to remove ${ROOT}/var/cache/moblock"
fi
}
|