diff --git a/Dockerfile b/Dockerfile index a2ae1aa..75968ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ WORKDIR /src RUN set -ex \ && apk --no-cache add \ + bash \ curl \ git \ make \ diff --git a/Makefile b/Makefile index a7e8445..946371d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ default: blacklist: - curl -sSfL https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '/^(#.*|0.0.0.0.*|)$$/' > blacklist - # Add local blacklist - cat blacklist.local >> blacklist + bash build_blacklist.sh diff --git a/build_blacklist.sh b/build_blacklist.sh new file mode 100644 index 0000000..a372739 --- /dev/null +++ b/build_blacklist.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +target=blacklist + +# Download compiled blacklist +curl -sSfL https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '/^(#.*|0.0.0.0.*|)$$/' >${target} + +# Remove entries on local whitelist +for entry in $(cat whitelist.local); do + grep -v "${entry}" ${target} >${target}.tmp + mv ${target}.tmp ${target} +done + +# Add local blacklist +cat blacklist.local >>${target} diff --git a/whitelist.local b/whitelist.local new file mode 100644 index 0000000..91529d5 --- /dev/null +++ b/whitelist.local @@ -0,0 +1 @@ +app.pr0gramm.com