summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--network/hostsblock/README15
-rw-r--r--network/hostsblock/doinst.sh19
-rw-r--r--network/hostsblock/hostsblock.SlackBuild79
-rw-r--r--network/hostsblock/hostsblock.info10
-rw-r--r--network/hostsblock/no-dnsmasq.patch52
-rw-r--r--network/hostsblock/slack-desc19
6 files changed, 194 insertions, 0 deletions
diff --git a/network/hostsblock/README b/network/hostsblock/README
new file mode 100644
index 0000000000..d52b818eb4
--- /dev/null
+++ b/network/hostsblock/README
@@ -0,0 +1,15 @@
+Hostsblock is a bash script for Linux designed to take advantage of the
+/etc/hosts file to provide system-wide blocking of internet advertisements,
+malicious domains, trackers, and other undesirable content. To do so, it
+downloads a configurable set of blocklists and processes and their entries into
+a singular file.
+
+The SlackBuild assumes that dnsmasq is not available so it will configure
+hostsblock to overwrite the current /etc/hosts file. The install script will
+backup the current /etc/hosts file to /etc/hostsblock/hosts.head if it does
+not already exist.
+
+After uninstalling hostsblock, you should copy hosts.head back to /etc/hosts.
+
+To have hostsblock automatically update /etc/hosts once a week, run:
+ ln -sf /usr/sbin/hostsblock /etc/cron.weekly/hostsblock
diff --git a/network/hostsblock/doinst.sh b/network/hostsblock/doinst.sh
new file mode 100644
index 0000000000..1cdd2c6ca5
--- /dev/null
+++ b/network/hostsblock/doinst.sh
@@ -0,0 +1,19 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/hostsblock/rc.conf.new
+
+# backup existing /etc/hosts to /etc/hostsblock/hosts.head if it doesn't already exist
+if [ ! -r /etc/hostsblock/hosts.head ] ; then
+ cp /etc/hosts /etc/hostsblock/hosts.head
+fi
diff --git a/network/hostsblock/hostsblock.SlackBuild b/network/hostsblock/hostsblock.SlackBuild
new file mode 100644
index 0000000000..ed79530350
--- /dev/null
+++ b/network/hostsblock/hostsblock.SlackBuild
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# SlackBuild script for hostsblock
+
+# Copyright 2013 Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=hostsblock
+VERSION=${VERSION:-0.12.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+ARCH="noarch"
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# set up to not use dnsmasq by default
+patch -p1 --verbose < $CWD/no-dnsmasq.patch
+
+install -Dm755 hostsblock.sh $PKG/usr/sbin/hostsblock
+install -Dm755 hostsblock-urlcheck.sh $PKG/usr/sbin/hostsblock-urlcheck
+install -Dm644 rc.conf $PKG/etc/hostsblock/rc.conf.new
+install -Dm644 black.list $PKG/etc/hostsblock/black.list
+install -Dm644 white.list $PKG/etc/hostsblock/white.list
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README.md $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/hostsblock/hostsblock.info b/network/hostsblock/hostsblock.info
new file mode 100644
index 0000000000..ce6240fe86
--- /dev/null
+++ b/network/hostsblock/hostsblock.info
@@ -0,0 +1,10 @@
+PRGNAM="hostsblock"
+VERSION="0.12.3"
+HOMEPAGE="http://gaenserich.github.io/hostsblock/"
+DOWNLOAD="http://jaxartes.net/files/hostsblock-0.12.3.tar.bz2"
+MD5SUM="20eb8ee8627c0980f57d54727b6bd797"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Benjamin Trigona-Harany"
+EMAIL="slackbuilds@jaxartes.net"
diff --git a/network/hostsblock/no-dnsmasq.patch b/network/hostsblock/no-dnsmasq.patch
new file mode 100644
index 0000000000..ec79da210e
--- /dev/null
+++ b/network/hostsblock/no-dnsmasq.patch
@@ -0,0 +1,52 @@
+diff -Nur hostsblock-0.12.3/rc.conf hostsblock-0.12.3a/rc.conf
+--- hostsblock-0.12.3/rc.conf 2013-10-31 09:02:49.000000000 -0700
++++ hostsblock-0.12.3a/rc.conf 2013-12-27 19:33:54.592390930 -0800
+@@ -34,8 +34,7 @@
+ # blocklists. If not using a dns caching daemon like dnsmasq, this should be
+ # /etc/hosts. Include hosts file entries which you want to maintain in the
+ # "hostshead" entry, such as your loopback device (e.g. 127.0.0.1 localhosts)
+-hostsfile="/etc/hosts.block"
+-#hostsfile="/etc/hosts" # If not using a dns caching daemon
++hostsfile="/etc/hosts" # If not using a dns caching daemon
+
+ # REDIRECT URL. Url to which blocked hosts will be redirect, either 0.0.0.0 or
+ # 127.0.0.1. This replaces any entries to 0.0.0.0 and 127.0.0.1. If you run a
+@@ -56,17 +55,9 @@
+ # "addn-hosts=/etc/hosts.block", where /etc/hosts.block is your final hosts file
+ # (see the "hostsfile" variable). This routine will be also run whenever changes
+ # are made via hostsblock-urlcheck.
+-postprocess(){ #
+- /etc/rc.d/dnsmasq restart # For dnsmasq under initscripts
+-} #
+-
+-#postprocess(){ #
+-# systemctl restart dnsmasq.service # For dnsmasq under systemd
+-#} #
+-
+-#postprocess(){ #
+-# /bin/true # If not using a dns caching daemon
+-#} #
++postprocess(){ #
++ /bin/true # If not using a dns caching daemon
++} #
+
+ # HEAD FILE. File containing hosts file entries which you want at the beginning
+ # of the resultant hosts file, e.g. for loopback devices and IPV6 entries. Use
+@@ -74,8 +65,7 @@
+ # /etc/hosts so as to preserve your loopback devices. Give hostshead="0" to
+ # disable this feature. For those targeting /etc/hosts, it is advisable to copy
+ # their old /etc/hosts file to this file so as to preserve existing entries.
+-hostshead="0"
+-#hostshead="/etc/hostsblock/hosts.head" # If not using dns caching.
++hostshead="/etc/hostsblock/hosts.head" # If not using dns caching.
+
+ # BLACKLISTED SUBDOMAINS. File containing specific subdomains to blacklist which
+ # may not be in the downloaded blacklists. Be sure to provide not just the
+@@ -106,7 +96,6 @@
+ 'http://hosts-file.net/ad_servers.asp' # anti-ads-only version of hpHosts main list (hosts-file.net)
+ ## RECOMMENDED LISTS
+ 'http://hosts-file.net/hphosts-partial.asp' # hpHosts inter-release (hosts-file.net/)
+-'http://hostsfile.org/Downloads/BadHosts.unx.zip' # anti-malware (hostsfile.org/hosts.html)
+ 'http://hostsfile.mine.nu/Hosts.zip' # anti-ad (hostsfile.mine.nu)
+ 'http://someonewhocares.org/hosts/hosts' # anti-ad and anti-malware (someonewhocares.org/hosts/)
+ 'http://sysctl.org/cameleon/hosts' # anti-ad (sysctl.org/cameleon/)
diff --git a/network/hostsblock/slack-desc b/network/hostsblock/slack-desc
new file mode 100644
index 0000000000..8845ac4d9d
--- /dev/null
+++ b/network/hostsblock/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+hostsblock: hostsblock (an ad- and malware-blocking cron script for Linux)
+hostsblock:
+hostsblock: Hostsblock is a bash script for Linux designed to take advantage of
+hostsblock: the HOSTS file to provide system-wide blocking of internet
+hostsblock: advertisements, malicious domains, trackers and other undesirable
+hostsblock: content. To do so, it downloads a configurable set of blocklists and
+hostsblock: processes and their entries into a singular HOSTS file.
+hostsblock:
+hostsblock:
+hostsblock:
+hostsblock: