diff options
author | Alexander Verbovetsky <alik@ejik.org> | 2019-10-26 22:09:30 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-10-26 22:09:30 +0700 |
commit | 54a6edba5beb4763124b6705971dab8f0aef76e5 (patch) | |
tree | 3f3c43ebfb473894055db4470181c8bb04ae8986 /network/AdGuardHome | |
parent | d9abd80e0184668f531ea3093979f611f8cc8998 (diff) |
network/AdGuardHome: Added (Ad blocking DNS server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/AdGuardHome')
-rw-r--r-- | network/AdGuardHome/AdGuardHome.SlackBuild | 86 | ||||
-rw-r--r-- | network/AdGuardHome/AdGuardHome.info | 10 | ||||
-rw-r--r-- | network/AdGuardHome/README | 17 | ||||
-rw-r--r-- | network/AdGuardHome/README.SBo | 19 | ||||
-rw-r--r-- | network/AdGuardHome/doinst.sh | 25 | ||||
-rw-r--r-- | network/AdGuardHome/rc.AdGuardHome | 54 | ||||
-rw-r--r-- | network/AdGuardHome/slack-desc | 19 |
7 files changed, 230 insertions, 0 deletions
diff --git a/network/AdGuardHome/AdGuardHome.SlackBuild b/network/AdGuardHome/AdGuardHome.SlackBuild new file mode 100644 index 000000000000..c4da27a559aa --- /dev/null +++ b/network/AdGuardHome/AdGuardHome.SlackBuild @@ -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} diff --git a/network/AdGuardHome/AdGuardHome.info b/network/AdGuardHome/AdGuardHome.info new file mode 100644 index 000000000000..0b0d6426c709 --- /dev/null +++ b/network/AdGuardHome/AdGuardHome.info @@ -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" diff --git a/network/AdGuardHome/README b/network/AdGuardHome/README new file mode 100644 index 000000000000..6903da66804e --- /dev/null +++ b/network/AdGuardHome/README @@ -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 diff --git a/network/AdGuardHome/README.SBo b/network/AdGuardHome/README.SBo new file mode 100644 index 000000000000..98ba0c50a94a --- /dev/null +++ b/network/AdGuardHome/README.SBo @@ -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 diff --git a/network/AdGuardHome/doinst.sh b/network/AdGuardHome/doinst.sh new file mode 100644 index 000000000000..b842b7ff5844 --- /dev/null +++ b/network/AdGuardHome/doinst.sh @@ -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 diff --git a/network/AdGuardHome/rc.AdGuardHome b/network/AdGuardHome/rc.AdGuardHome new file mode 100644 index 000000000000..23832689d130 --- /dev/null +++ b/network/AdGuardHome/rc.AdGuardHome @@ -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 diff --git a/network/AdGuardHome/slack-desc b/network/AdGuardHome/slack-desc new file mode 100644 index 000000000000..e6984b7aeda6 --- /dev/null +++ b/network/AdGuardHome/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------------------------------------------------------| +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: |