summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Santos (javamonger) <daniel.santos@pobox.com>2007-11-05 22:19:49 +0000
committerDaniel Santos (javamonger) <daniel.santos@pobox.com>2007-11-05 22:19:49 +0000
commitc776f10505f7a17ffeb4777c75d5ff852a04dda4 (patch)
tree92f67bc3853f4148dccfbcd72a09f4cddc7c6cce /net-misc
parentnet-misc/ypd: remove old version (diff)
downloadsunrise-c776f10505f7a17ffeb4777c75d5ff852a04dda4.tar.gz
sunrise-c776f10505f7a17ffeb4777c75d5ff852a04dda4.tar.bz2
sunrise-c776f10505f7a17ffeb4777c75d5ff852a04dda4.zip
net-misc/moblock: updated ebuild for bug #143535
svn path=/sunrise/; revision=4967
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/moblock/ChangeLog25
-rw-r--r--net-misc/moblock/Manifest7
-rw-r--r--net-misc/moblock/files/0.8-r1/confd118
-rwxr-xr-xnet-misc/moblock/files/0.8-r1/initd108
-rwxr-xr-xnet-misc/moblock/files/0.8-r1/moblock-stats51
-rwxr-xr-xnet-misc/moblock/files/0.8-r1/moblock-update180
-rw-r--r--net-misc/moblock/moblock-0.8-r1.ebuild96
7 files changed, 584 insertions, 1 deletions
diff --git a/net-misc/moblock/ChangeLog b/net-misc/moblock/ChangeLog
index fba551ded..8d6dcea94 100644
--- a/net-misc/moblock/ChangeLog
+++ b/net-misc/moblock/ChangeLog
@@ -2,6 +2,31 @@
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 05 Nov 2007; Daniel Santos (javamonger) <daniel.santos@pobox.com>
+ +files/0.8-r1/confd, +files/0.8-r1/initd, +files/0.8-r1/moblock-stats,
+ +files/0.8-r1/moblock-update, +moblock-0.8-r1.ebuild:
+ Addresses issues in bug #143535
+ * Added update script (credit also to Jonathan Schroeder & Peter Avramucz)
+ * Fixed bugs in init.d as per comment #7
+ - changed PID to PIDFILE
+ - removed call to modprobe
+ * Added script to extract stats from MoBlock daemon
+ * Updated conf.d file, added blocklist servers and the lists with
+ descriptions
+ * ebuild now checks for needed kernel options and iptables (thanks Nathan
+ Caldwell)
+ * Moved some files and directories around to better adhere to FHS
+ (http://www.pathname.com/fhs/pub/fhs-2.3.html)
+ - Moved compiled blocklist file from /etc/moblock to /var/db/moblock
+ - Downloaded blocklist files now go in /var/cache/moblock
+ - Removed /etc/moblock dir
+ * Added ~amd64 KEYWORD
+ TODO list:
+ * Downloaded lists in /var/cache/moblock not deleted when unmerged. If we
+ do delete them, this will force them to re-download when upgrading.
+ * Should log files be removed when unmerging? -- currently commented out.
+ * Is exclusions list being handled correctly?
+
04 Dec 2006; Markus Ullmann <jokey@gentoo.org> ChangeLog:
nothing executable here
diff --git a/net-misc/moblock/Manifest b/net-misc/moblock/Manifest
index 62671b0c1..8d4214907 100644
--- a/net-misc/moblock/Manifest
+++ b/net-misc/moblock/Manifest
@@ -1,7 +1,12 @@
+AUX 0.8-r1/confd 2870 RMD160 2ac3764bd0d2df507895832e8642c1f372c90064 SHA1 e1c8d723b827c869b3656d573e4b3173f666f652 SHA256 e3acf50c6d6b56ba2b3f045514cdeaea30823091407e22eff86afd378d18e713
+AUX 0.8-r1/initd 2664 RMD160 fbace6642fd3d8a6f062ccac37ee60494049f322 SHA1 b001a7c815e627b1f12e170d7a2e6605bf39997e SHA256 8642a30eac4d66d7ecf2c97177757ab6e1a98e9285fe3138227ea61c59abe1b8
+AUX 0.8-r1/moblock-stats 1151 RMD160 91ff2ec3bd73426966139bc3cf4bfa1f151131af SHA1 99f7c94f509652482e887bcd8325ce96e7e6d66e SHA256 a4dabea254e10ce8d80546e55c7b98e2cf36b8b8e76bb69a423d3a3b07ee6532
+AUX 0.8-r1/moblock-update 3915 RMD160 3471581a8b09c69bfcb6bc9e96aa46f6a82ff72d SHA1 37c7f830aa1413b2ad5f130cfa59142d0277047b SHA256 812d20305f78bfa3b2b74c474648b3aa5de2982c6a3de9b0fc5f0e716b72246e
AUX confd 413 RMD160 18c2e24e5d4806d7b4941588581f505d88816ce8 SHA1 14064540969b27377557552edebd99fd60f97041 SHA256 a463f9078de42566b166bda491a65aedb4eb5145c49f784706c4071fee86769a
AUX initd 2409 RMD160 f621fae5624e565f24a1430b5ab865d57a2fe031 SHA1 6aea2787ad08c6bdc6f254ce9cd4a8f1bc8336d1 SHA256 13a14c0ebb504ff3f9695675412cc045c9819e4fda862494e3af600ea95e0402
AUX moblock-0.8-makefile.patch 825 RMD160 1fc36ed1c33267a391d2daffaff5c60043c69017 SHA1 260c99a69a6aa7a3df697330898783b98e72e072 SHA256 0d780e33c7f762d62ee9223b072b3ac0ccbf52e81934a4d505933528b3d48ca7
DIST MoBlock-0.8-i586.tar.bz2 18553 RMD160 2190cfb55977ad23176ddb43e410ee5d9293a518 SHA1 e9e7b47622eb606b6c429fc507fc50d0c037487e SHA256 30d6d56fe72606ffa308fb8e6edd44c2b1806dfa4da8a13bde046964601fd904
+EBUILD moblock-0.8-r1.ebuild 2541 RMD160 68aa7785574da4cdc5a6978e8db3ede09a308ddc SHA1 f0f8182222c9e10d03528b11b579678d38ba650e SHA256 91049d9ca545961481dfc554f6d223b551ef6da02bb9d3c1a0909a989b2c4ff4
EBUILD moblock-0.8.ebuild 958 RMD160 f2844ed2d1780f9519117befc88903275563582d SHA1 1515eeadc32f23e07ec6efcbd5c170e3fd5bee87 SHA256 b2c76355c9b33fbcf3b17c11481eaacaa68d8a8c33061be5b1d04e938b54e88f
-MISC ChangeLog 389 RMD160 87b0cef474fe388d91020ed1c0476d33a164d07d SHA1 c410c533a23ea5ae80cc78f27b5c7cb44a3a12d5 SHA256 7f0444adafb509f3ba8fe6d5c3c87790de58054785943b17a405ad8fea08394f
+MISC ChangeLog 1626 RMD160 637113493583061e64ee21a52d72b1c0832371c6 SHA1 8dd3bcf9961e7c5b326d7045d56c6b92e9032ad5 SHA256 d35e713e429e327eeaf2d1d11dcee660d22f5ed46de721a8edc88b8b7bfad229
MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42
diff --git a/net-misc/moblock/files/0.8-r1/confd b/net-misc/moblock/files/0.8-r1/confd
new file mode 100644
index 000000000..1048e6120
--- /dev/null
+++ b/net-misc/moblock/files/0.8-r1/confd
@@ -0,0 +1,118 @@
+
+ACTIVATE_CHAINS=1
+WHITE_TCP_IN=""
+WHITE_UDP_IN=""
+WHITE_TCP_OUT=""
+WHITE_UDP_OUT=""
+WHITE_TCP_FORWARD=""
+WHITE_UDP_FORWARD=""
+
+TARGET="NFQUEUE"
+
+PIDFILE="/var/run/moblock.pid"
+LOGFILE="/var/log/moblock.log"
+
+# Valid values for BLOCKLISTTYPE:
+# -d blocklist is an ipfilter.dat file
+# -n blocklist is a peerguardian 2.x file (.p2b)
+# -p blocklist is a peerguardian file (.p2p)
+BLOCKLISTTYPE="-p"
+BLOCKLISTFILE="/var/db/moblock/p2p.p2p"
+
+# This is where blocklists will be downloaded to when performing updates.
+BLOCKLISTDIR="/var/cache/moblock"
+
+BLOCKLISTSUFFIX="gz"
+BLOCKLISTSERVERS="
+ http://www.bluetack.co.uk/config
+ http://www.bluetack.nl/bluetack
+ http://www.btack.info/bluetack
+ http://www.bluetack.info/temp
+"
+# This mirror is broken, it doesn't return a real HTTP error code when it fails.
+# http://min.midco.net/jinx/bluetack
+
+# For more information on blocklists, go read
+# http://www.bluetack.co.uk/modules.php?name=FAQ&myfaq=yes&id_cat=6&categories=Blacklists+FAQ
+
+# All known Microsoft Corp and associated IP ranges from around
+# the world.
+BLOCKLISTS+="Microsoft "
+
+# Ad Trackers
+BLOCKLISTS+="ads-trackers-and-bad-pr0n "
+
+# Bogon Addresses
+BLOCKLISTS+="bogon "
+
+# DShield (http://www.dshield.org)
+BLOCKLISTS+="dshield "
+
+# Educational Institution Ranges
+#BLOCKLISTS+="edu "
+
+# Recommended Exclusions
+BLOCKLISTS+="exclusions "
+
+# LAN Blacklist 0.* 10.* and 192.168.* Ranges
+#BLOCKLISTS+="fornonlancomputers "
+
+# Hijacked IP address blocks
+BLOCKLISTS+="hijacked "
+
+# IANA Multicast Addresses
+BLOCKLISTS+="iana-multicast "
+
+# IANA Private Addresses
+BLOCKLISTS+="iana-private "
+
+# IANA Reserved Addresses
+BLOCKLISTS+="iana-reserved "
+
+# Level 1
+# * anti-p2p companies / p2p trackers
+# * fake p2p file sources
+# * Government, Military, Science, Research Labs
+# * Bad Education facilities
+BLOCKLISTS+="level1 "
+
+# Level 2 - Corporations (banks, financial institutions, etc.)
+BLOCKLISTS+="level2 "
+
+# Level 3
+BLOCKLISTS+="level3 "
+
+# Suspicious IP's that are under investigation.
+BLOCKLISTS+="rangetest "
+
+# Webspiders and bots (includes Google, Yahoo!, et. al.)
+#BLOCKLISTS+="spider "
+
+# Spyware, adware, malware and trojans initiated from web sites.
+BLOCKLISTS+="spyware "
+
+# People who have been reported for bad deeds in p2p (having files that
+# contain viruses, etc.)
+BLOCKLISTS+="templist "
+
+# Trojans & port scanners.
+BLOCKLISTS+="trojan "
+
+# eMule "Normal" IP Filter - A compilation of the below lists. Please DO NOT
+# use this in addition to any of the below.
+# * Microsoft
+# * bogon
+# * fornonlancomputers
+# * hijacked
+# * iana-multicast
+# * iana-private
+# * iana-reserved
+# * level1
+# * level2
+# * templist
+#BLOCKLISTS+="nipfilter.dat "
+
+# eMule "Parinoid" IP Filter - A compilation of ALL of the above lists. DO NOT
+# use this in addition to the above lists as you will just be wasting bandwidth.
+#BLOCKLISTS+="pipfilter.dat "
+
diff --git a/net-misc/moblock/files/0.8-r1/initd b/net-misc/moblock/files/0.8-r1/initd
new file mode 100755
index 000000000..ce07ae27c
--- /dev/null
+++ b/net-misc/moblock/files/0.8-r1/initd
@@ -0,0 +1,108 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+checkconfig() {
+ test -s "${BLOCKLISTFILE}" && return
+ einfo
+ einfo "Block list file ${BLOCKLISTFILE} not found, running moblock-update."
+ einfo
+ moblock-update
+ test -s "${BLOCKLISTFILE}" && return
+
+ eerror "moblock-update failed, cannot start"
+ return 1
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting MoBlock"
+
+ # Is this needed?
+ #modprobe ipt_NFQUEUE
+
+ # Filter all traffic, edit for your needs
+
+ iptables -N MOBLOCK_IN
+ iptables -N MOBLOCK_OUT
+ iptables -N MOBLOCK_FW
+
+ if [ ${ACTIVATE_CHAINS} -eq 1 ]; then
+ iptables -I INPUT -p all -m state --state NEW -j MOBLOCK_IN
+ iptables -I OUTPUT -p all -m state --state NEW -j MOBLOCK_OUT
+ iptables -I FORWARD -p all -m state --state NEW -j MOBLOCK_FW
+ fi
+
+ iptables -I MOBLOCK_IN -p all -j ${TARGET}
+ iptables -I MOBLOCK_OUT -p all -j ${TARGET}
+ iptables -I MOBLOCK_FW -p all -j ${TARGET}
+
+ for PORT in ${WHITE_TCP_OUT}; do
+ iptables -I MOBLOCK_OUT -p tcp --dport ${PORT} -j ACCEPT
+ done
+ for PORT in ${WHITE_UDP_OUT}; do
+ iptables -I MOBLOCK_OUT -p udp --dport ${PORT} -j ACCEPT
+ done
+
+ for PORT in ${WHITE_TCP_IN}; do
+ iptables -I MOBLOCK_IN -p tcp --dport ${PORT} -j ACCEPT
+ done
+ for PORT in ${WHITE_UDP_IN}; do
+ iptables -I MOBLOCK_IN -p udp --dport ${PORT} -j ACCEPT
+ done
+
+ for PORT in ${WHITE_TCP_FORWARD}; do
+ iptables -I MOBLOCK_FW -p tcp --dport ${PORT} -j ACCEPT
+ done
+ for PORT in ${WHITE_UDP_FORWARD}; do
+ iptables -I MOBLOCK_FW -p udp --dport ${PORT} -j ACCEPT
+ done
+
+
+ # Loopback traffic fix
+
+ iptables -I INPUT -p all -i lo -j ACCEPT
+ iptables -I OUTPUT -p all -o lo -j ACCEPT
+
+ # Here you can change block list and log files
+
+ if start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} \
+ --exec /usr/sbin/moblock -- \
+ ${BLOCKLISTTYPE} "${BLOCKLISTFILE}" "${LOGFILE}"; then
+ eend 0
+ else
+ # If startup failed, we need to cleanup iptables
+ cleanup_iptables
+ eend 1
+ fi
+}
+
+cleanup_iptables() {
+ if [ ${ACTIVATE_CHAINS} -eq 1 ]; then
+ iptables -D INPUT -p all -m state --state NEW -j MOBLOCK_IN
+ iptables -D OUTPUT -p all -m state --state NEW -j MOBLOCK_OUT
+ iptables -D FORWARD -p all -m state --state NEW -j MOBLOCK_FW
+ fi
+
+ iptables -D INPUT -p all -i lo -j ACCEPT
+ iptables -D OUTPUT -p all -o lo -j ACCEPT
+
+ iptables -F MOBLOCK_IN
+ iptables -X MOBLOCK_IN
+ iptables -F MOBLOCK_OUT
+ iptables -X MOBLOCK_OUT
+ iptables -F MOBLOCK_FW
+ iptables -X MOBLOCK_FW
+}
+
+stop() {
+
+ ebegin "Stopping MoBlock"
+ start-stop-daemon --stop --pidfile ${PIDFILE}
+ eend ${?}
+
+ # On exit delete the rules we added
+ cleanup_iptables
+}
diff --git a/net-misc/moblock/files/0.8-r1/moblock-stats b/net-misc/moblock/files/0.8-r1/moblock-stats
new file mode 100755
index 000000000..b8d472126
--- /dev/null
+++ b/net-misc/moblock/files/0.8-r1/moblock-stats
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# This script is screwy enough that it deserves some documentation. To get
+# statistics from the moblock daemon, you send it SIGUSR2 (man signal(7) for
+# more info). This causes moblock to output the statistics to
+# /var/log/MoBlock.stats. So this suicidal script sends SIGUSR2 to Moblock,
+# scrapes the .stats file and sends SIGINT to it's self when it finds text
+# that indicates the end of the report has been reached.
+#
+# It's screwy, but effective.
+
+source /etc/conf.d/moblock
+source /sbin/functions.sh
+
+moblock_pidfile=/var/run/moblock.pid
+stat_log_name=/var/log/MoBlock.stats
+
+die () {
+ eerror "$@"
+ exit 1
+}
+
+read_stat_log() {
+ while read; do
+ if [ "${REPLY}" = "----------------------------------------" ]; then
+ echo
+ einfo End of statistics
+ echo
+ kill -s INT $1
+ return
+ else
+ echo "$REPLY"
+ fi
+ done
+}
+
+if [ ! -f "${moblock_pidfile}" ]; then
+ die "MoBlock not running."
+fi
+
+tail --pid=$$ --lines=0 -f < ${stat_log_name} | read_stat_log $$ &
+
+# Make sure tail starts before we send SIGUSR2
+sleep 0.125
+echo
+einfo Requesting stats from MoBlock daemon...
+echo
+
+kill -s SIGUSR2 $(cat ${moblock_pidfile})
+
+wait
diff --git a/net-misc/moblock/files/0.8-r1/moblock-update b/net-misc/moblock/files/0.8-r1/moblock-update
new file mode 100755
index 000000000..3fa8db25f
--- /dev/null
+++ b/net-misc/moblock/files/0.8-r1/moblock-update
@@ -0,0 +1,180 @@
+#!/bin/bash
+
+source /etc/conf.d/moblock
+source /sbin/functions.sh
+
+log_file=/var/log/moblock-update.log
+tmp_dir=/tmp/moblock-update.$$
+
+typeset -i successful_dl_count=0
+typeset -i failed_dl_count=0
+typeset -i FAIL=0
+
+cleanup() {
+ log_msg "$0 exiting.
+
+-------------------------------------------------------------------------------
+
+
+"
+ rm -rf ${tmp_dir}
+}
+
+die() {
+ eerror "Update failed: $@" | tee -a ${log_file}
+ eerror "See /var/log/moblock-update.log for details."
+ cleanup
+ exit 1;
+}
+
+log_msg() {
+ echo -e "$(date): $@" >> ${log_file}
+}
+
+init() {
+ if [ -z "${BLOCKLISTSERVERS}" ]; then
+ eerror "There is no BLOCKLISTSERVERS defined in /etc/conf.d/moblock."
+ eindent
+ eerror "Please set this variable to the list of servers you wish to"
+ eerror "download from."
+ eoutdent
+
+ FAIL=1
+ fi
+
+ if [ -z "${BLOCKLISTS}" ]; then
+ eerror "There is no BLOCKLISTS defined in /etc/conf.d/moblock."
+ eindent
+ eerror "Please set this variable to the lists you wish to use."
+ eoutdent
+
+ FAIL=1
+ fi
+
+ if [ -z "${BLOCKLISTFILE}" ]; then
+ eerror "There is no BLOCKLISTFILE defined in /etc/conf.d/moblock."
+ eindent
+ eerror "Please set this variable to the file you wish to output the"
+ eerror "merged block list to."
+ eoutdent
+
+ FAIL=1
+ fi
+
+ if [ -z "${BLOCKLISTDIR}" ]; then
+ eerror "There is no BLOCKLISTDIR defined in /etc/conf.d/moblock."
+ eindent
+ eerror "Please set this variable to the directory you wish to store"
+ eerror "the downloaded lists in."
+ eoutdent
+
+ FAIL=1
+ fi
+
+ [ ${FAIL} -eq 0 ] || die "invalid configuration"
+}
+
+# Iterate through servers until we get one to work or they all fail.
+getAFile() {
+ local tmp_file=${tmp_dir}/${1}.wget.log
+ for base_url in ${BLOCKLISTSERVERS}; do
+ log_msg "Attempting to downloading ${1}.${BLOCKLISTSUFFIX} from location ${base_url}"
+ if wget -P ${BLOCKLISTDIR} \
+ -N ${base_url}/${1}.${BLOCKLISTSUFFIX} \
+ -a ${tmp_file}; then
+ rm ${tmp_file}
+ return 0
+ fi
+ done
+
+ log_msg "Failed to download ${1}.${BLOCKLISTSUFFIX}.
+${BAD}wget output ---------->${NORMAL}
+$(cat ${tmp_file})
+${BAD}<---------- end of wget output${NORMAL}"
+ rm ${tmp_file}
+ return 1
+}
+
+getBlocklists() {
+ einfo Downloading lists...
+ eindent
+
+ for i in ${BLOCKLISTS}; do
+ ebegin "Downloading ${i}" | tee -a ${log_file}
+
+ if getAFile $i; then
+ successful_dl_count=${successful_dl_count}+1
+ eend 0 | tee -a ${log_file}
+ else
+ failed_dl_count=${failed_dl_count}+1
+ eend 1 | tee -a ${log_file}
+ fi
+ done
+
+ eoutdent
+
+ if [ ${failed_dl_count} -ne 0 ]; then
+ if [ ${successful_dl_count} -eq 0 ]; then
+ die "All downloads failed"
+ else
+ ewarn "WARNING: ${failed_dl_count} downloads failed! See /var/log/moblock-update.log" \
+ | tee -a ${log_file}
+ ewarn "for details. Previous blocklists will be used failed items." \
+ | tee -a ${log_file}
+ fi
+ fi
+}
+
+mergeFiles() {
+ einfo Unpacking and merging lists...
+ eindent
+
+ local new_p2p_file=${tmp_dir}/new.p2p
+
+ for i in ${BLOCKLISTS}; do
+ ebegin Merging ${i} | tee -a ${log_file}
+
+ gunzip -c ${BLOCKLISTDIR}/${i}.${BLOCKLISTSUFFIX} >> ${new_p2p_file} 2>>${log_file} \
+ || die "Failed to extract list '${i}'"
+
+ eend $? | tee -a ${log_file}
+ done
+
+ mv ${new_p2p_file} ${BLOCKLISTFILE}
+
+ eoutdent
+}
+
+reloadList() {
+ moblock_pid=$(cat /var/run/moblock.pid 2>/dev/null)
+
+ if ps -p ${moblock_pid} > /dev/null 2>&1; then
+ einfo "Reloading block list"
+ kill -s HUP ${moblock_pid}
+ eend $?
+ fi
+}
+
+main() {
+ mkdir -p ${BLOCKLISTDIR} || die "Failed to create dir ${BLOCKLISTDIR}."
+ mkdir -p ${tmp_dir} || die "Failed to create dir ${tmp_dir}"
+
+ einfo "Updating moblock..." | tee -a ${log_file}
+ eindent
+ log_msg "$0 initiated."
+
+ getBlocklists
+ mergeFiles
+ reloadList | tee -a ${log_file}
+
+ eoutdent
+ if [ ${failed_dl_count} -eq 0 ]; then
+ einfo "MoBlock update completed successfully." | tee -a ${log_file}
+ else
+ ewarn "MoBlock update partially successful." | tee -a ${log_file}
+ fi
+ cleanup
+}
+
+main
+
diff --git a/net-misc/moblock/moblock-0.8-r1.ebuild b/net-misc/moblock/moblock-0.8-r1.ebuild
new file mode 100644
index 000000000..4808dec4f
--- /dev/null
+++ b/net-misc/moblock/moblock-0.8-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2007 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="A linux console application that 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}
+
+check_kernel_config() {
+ if !(linux_chkconfig_present NETFILTER \
+ && linux_chkconfig_present NETFILTER_XTABLES \
+ && linux_chkconfig_present NETFILTER_XT_TARGET_NFQUEUE \
+ && linux_chkconfig_present IP_NF_IPTABLES \
+ && linux_chkconfig_present IP_NF_FILTER); then
+ eerror
+ eerror "${P} requires the following kernel options:"
+ eerror " CONFIG_NETFILTER"
+ eerror " CONFIG_NETFILTER_XTABLES"
+ eerror " CONFIG_NETFILTER_XT_TARGET_NFQUEUE"
+ eerror " CONFIG_IP_NF_IPTABLES"
+ eerror " CONFIG_IP_NF_FILTER"
+ eerror
+ die "Missing kernel components"
+ fi
+}
+
+src_unpack() {
+ check_kernel_config
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${P}-makefile.patch"
+}
+
+src_compile() {
+ emake CC=$(tc-getCC) || die "emake failed"
+}
+
+
+# TODO: Should we be doing touch on the blocklist and log files? This causes
+# them to be deleted when unmerged.
+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/p2p.p2p" \
+ || die "touch ${D}/var/db/moblock/p2p.p2p"
+
+ keepdir /var/cache/moblock
+
+ #dodir /var/log
+ #touch "${D}/var/log/moblock.log" \
+ # || die "touch ${D}/var/log/moblock.log"
+
+ #touch "${D}/var/log/moblock-update.log" \
+ # || die "touch ${D}/var/log/moblock-update.log"
+
+ #touch "${D}/var/log/MoBlock.stats" \
+ # || die "touch ${D}/var/log/MoBlock.stats"
+
+ 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"
+}
+
+# TODO: Should we remove downloaded/cached files?
+#pkg_postrm() {
+# rm -rf /var/cache/moblock
+# return
+#}