]> Pileus Git - ~andy/sunrise/blob - net-misc/moblock/moblock-0.8-r2.ebuild
media-gfx/ktikz: Properly fix qt deps
[~andy/sunrise] / net-misc / moblock / moblock-0.8-r2.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit eutils linux-info toolchain-funcs
6
7 MY_P=MoBlock-${PV}
8
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"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="logrotate network-cron"
17
18 DEPEND="net-libs/libnetfilter_queue
19         net-libs/libnfnetlink"
20 RDEPEND="${DEPEND}
21         net-firewall/iptables
22         logrotate? ( app-admin/logrotate )"
23
24 S=${WORKDIR}/${MY_P}
25
26 CONFIG_CHECK="NETFILTER NETFILTER_XTABLES NETFILTER_XT_TARGET_NFQUEUE
27         IP_NF_IPTABLES IP_NF_FILTER NETFILTER_XT_MATCH_STATE"
28
29 src_unpack() {
30         unpack ${A}
31         epatch "${FILESDIR}"/${P}-{makefile,rename-stats-file,fix-nfq_unbind_pf-error,fix-broken-compile}.patch
32 }
33
34 src_compile() {
35         emake CC=$(tc-getCC) || die "emake failed"
36 }
37
38 src_install() {
39         dosbin "${FILESDIR}/${PVR}/"moblock-{update,stats} moblock || die
40
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
44
45         dodir /var/{db,cache}/moblock || die
46         touch "${D}/var/db/moblock/guarding.p2p" || die
47
48         if use network-cron; then
49                 dosym /usr/sbin/moblock-update /etc/cron.weekly/moblock-update || die
50         fi
51
52         if use logrotate; then
53                 insinto /etc/logrotate.d || die
54                 newins "${FILESDIR}/${PVR}/logrotate" moblock || die
55         fi
56
57         dodoc Changelog README || die
58 }
59
60 pkg_postinst() {
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."
66         else
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."
69         fi
70         elog ""
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/."
73 }
74
75 pkg_postrm() {
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"
80         fi
81 }