diff --git a/Makefile b/Makefile index 63f99cd..2c69d64 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ dir: mkdir -p /usr/local/share/removeadhosts install: dir + mkdir /etc/removeadhosts + touch /etc/removeadhosts/ads.txt cp src/* /usr/local/share/removeadhosts/ chown -R root:root /usr/local/share/removeadhosts chmod +x /usr/local/share/removeadhosts/removeadhosts.sh @@ -15,5 +17,7 @@ deactivate: remove: deactivate rm -f /etc/systemd/system/removeadhosts* rm -fr /usr/local/share/removeadhosts/ +purge: remove + rm -fr /etc/removeadhosts reinstall: remove activate diff --git a/src/removeadhosts.sh b/src/removeadhosts.sh index dfcd940..b724216 100755 --- a/src/removeadhosts.sh +++ b/src/removeadhosts.sh @@ -14,3 +14,12 @@ fi echo 'Downloading ad list' curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts 2>/dev/null | tee -a /etc/hosts >/dev/null + +echo 'Adding custom items from /etc/removeadhosts' +if [ -e /etc/removeadhosts/adlist.txt ] +then + cat /etc/removeadhosts/adlist.txt | \ + while read CMD; do + echo "0.0.0.0 $CMD" >> /etc/hosts + done +fi