diff options
-rwxr-xr-x | adlists/.gitignore | 4 | ||||
-rw-r--r-- | adlists/README | 1 | ||||
-rwxr-xr-x | buildAdBlocklist.sh | 2 | ||||
-rwxr-xr-x | retrieveAdBlocklists.sh | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/adlists/.gitignore b/adlists/.gitignore new file mode 100755 index 0000000..5e7d273 --- /dev/null +++ b/adlists/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/adlists/README b/adlists/README deleted file mode 100644 index 77fa04a..0000000 --- a/adlists/README +++ /dev/null @@ -1 +0,0 @@ -This directory is for the downloaded source ad block lists diff --git a/buildAdBlocklist.sh b/buildAdBlocklist.sh index c12d2a6..510b821 100755 --- a/buildAdBlocklist.sh +++ b/buildAdBlocklist.sh @@ -1,6 +1,6 @@ #°/bin/bash ADLISTDIR=adlists for adfile in $(ls $ADLISTDIR); do - grep -v '^#' < $ADLISTDIR/$adfile | grep -v '^$' | awk '{if (0 < match($0, "\t") || 0 < index($0, " ")) {split($0,b," "); print b[2]} else print $0}' | grep -v '^localhost$' | grep -v '^local$' | grep -v '^localhost.localdomain$' | grep -v '^ip6-localnet$' | grep -v '^ip6-localhost$' >> block.list + grep -v '^#' < $ADLISTDIR/$adfile | grep -v '^$' | awk '{if (0 < match($0, "\t") || 0 < index($0, " ")) {split($0,b," "); print b[2]} else print $0}' | grep -v '^localhost$' | grep -v '^local$' | grep -v '^localhost.localdomain$' | grep -v '^ip6-localnet$' | grep -v '^ip6-localhost$' | grep -v '^$' | while read blockedAddress; do echo "127.0.0.1 $blockedAddress"; done >> block.list done diff --git a/retrieveAdBlocklists.sh b/retrieveAdBlocklists.sh index a56c73e..480ee48 100755 --- a/retrieveAdBlocklists.sh +++ b/retrieveAdBlocklists.sh @@ -1,4 +1,4 @@ #!/bin/bash while read p; do - echo "$p" | awk '{split($0,a,"|"); system("wget -O adlists/"a[1] " " a[2])}' + echo "$p" | awk '{split($0,a,"|"); system("curl -s " a[2] " > adlists/"a[1])}' done < adfilelist.txt |