network/AdGuardHome: Added (Ad blocking DNS server).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Alexander Verbovetsky 2019-10-26 22:09:30 +07:00 committed by Willy Sudiarto Raharjo
parent d9abd80e01
commit 54a6edba5b
7 changed files with 230 additions and 0 deletions

View file

@ -0,0 +1,86 @@
#!/bin/sh
# Slackware build script for AdGuardHome
# Copyright 2019, Alexander Verbovetsky, Moscow, Russia
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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=AdGuardHome
VERSION=${VERSION:-0.99.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SUFFIX="linux_386"
elif [ "$ARCH" = "x86_64" ]; then
SUFFIX="linux_amd64"
elif [ "$ARCH" = "arm" ]; then
SUFFIX="linux_arm"
else
echo "$ARCH is not supported." >&2
exit 1
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/${PRGNAM}_$SUFFIX.tar.gz
cd $PRGNAM
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 {} \;
mkdir -p $PKG/usr/sbin $PKG/etc/rc.d
install -m 0755 -o root -g root AdGuardHome $PKG/usr/sbin
install -m 0644 -o root -g root $CWD/rc.AdGuardHome \
$PKG/etc/rc.d/rc.AdGuardHome.new
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
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}

View file

@ -0,0 +1,10 @@
PRGNAM="AdGuardHome"
VERSION="0.99.2"
HOMEPAGE="https://adguard.com/adguard-home.html"
DOWNLOAD="https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.99.2/AdGuardHome_linux_386.tar.gz"
MD5SUM="8842f102b2e1e8d1427fde0d4ddee1c6"
DOWNLOAD_x86_64="https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.99.2/AdGuardHome_linux_amd64.tar.gz"
MD5SUM_x86_64="2bb95c83990175464d8062a0246527d5"
REQUIRES=""
MAINTAINER="Alexander Verbovetsky"
EMAIL="alik@ejik.org"

View file

@ -0,0 +1,17 @@
AdGuard Home is a network-wide software for blocking ads and tracking.
It operates as a DNS server that re-routes tracking domains to a "black
hole", thus preventing your devices from connecting to those servers.
Key features of AdGuard Home:
* Blocking ads and trackers
* Customizing blocklists
* Built-in DHCP server
* HTTPS for the Admin interface
* Encrypted DNS upstream servers: DNS-over-HTTPS, DNS-over-TLS, DNSCrypt
* Running as a DNS-over-HTTPS or DNS-over-TLS server
* Blocking phishing and malware domains
* Parental control (blocking adult domains)
* Force Safe search on search engines
* Per-client (device) configuration
* Access settings

View file

@ -0,0 +1,19 @@
A simple init script /etc/rc.d/rc.AdGuardHome has been provided to run
AdGuard Home as a daemon.
To start AdGuard Home automatically at system start, add the following
to /etc/rc.d/rc.local:
# Start AdGuard Home
if [ -x /etc/rc.d/rc.AdGuardHome ]; then
rm -f /var/run/AdGuardHome.pid
/etc/rc.d/rc.AdGuardHome start
fi
To properly stop AdGuard Home on system shutdown, add the following to
/etc/rc.d/rc.local_shutdown:
# Stop AdGuard Home
if [ -x /etc/rc.d/rc.AdGuardHome ]; then
/etc/rc.d/rc.AdGuardHome stop
fi

View file

@ -0,0 +1,25 @@
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...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.AdGuardHome.new

View file

@ -0,0 +1,54 @@
#!/bin/sh
# Start/stop/restart the AdGuard Home
bin=/usr/sbin/AdGuardHome
config=/etc/AdGuardHome.yaml
workdir=/var/lib/AdGuardHome
pidfile=/var/run/AdGuardHome.pid
start_AdGuardHome() {
echo "Starting AdGuard Home... "
if [ -f $pidfile ]; then
echo "AdGuard Home is already running with PID $(cat ${pidfile})."
exit 0
fi
nohup $bin --config $config --work-dir $workdir --no-check-update \
--pidfile $pidfile 0<&- &>/dev/null &
}
stop_AdGuardHome() {
echo "Stoppping AdGuard Home... "
[ -f $pidfile ] && kill $(cat ${pidfile})
}
restart_AdGuardHome() {
stop_AdGuardHome
sleep 1
start_AdGuardHome
}
status_AdGuardHome() {
if [ -f $pidfile ]; then
echo "AdGuard Home is running with PID $(cat ${pidfile})."
else
echo "AdGuard Home is stopped."
exit 1
fi
}
case "$1" in
'start')
start_AdGuardHome
;;
'stop')
stop_AdGuardHome
;;
'restart')
restart_AdGuardHome
;;
'status')
status_AdGuardHome
;;
*)
echo "usage $0 start|stop|restart|status"
esac

View file

@ -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------------------------------------------------------|
AdGuardHome: AdGuardHome (Ad blocking DNS server)
AdGuardHome:
AdGuardHome: AdGuard Home is a network-wide software for blocking ads and tracking.
AdGuardHome: It operates as a DNS server that re-routes tracking domains to a
AdGuardHome: "black hole", thus preventing your devices from connecting to those
AdGuardHome: servers.
AdGuardHome:
AdGuardHome: Homepage: https://adguard.com/adguard-home.html
AdGuardHome:
AdGuardHome:
AdGuardHome: