summaryrefslogtreecommitdiff
path: root/TLD/generate.sh
diff options
context:
space:
mode:
authorhackademix2018-09-05 13:33:38 +0200
committerhackademix2018-09-05 15:08:41 +0200
commit6ffe07f8f6453d201005fae0a28299cb7ddec15b (patch)
treefb60fd47ccdd2a0c25d08e18834ffc1cbfb23bd9 /TLD/generate.sh
parent99a81a6f1f1cbc6b2dd6ccaf8bbe40dbe35f83b1 (diff)
downloadnoscript-6ffe07f8f6453d201005fae0a28299cb7ddec15b.tar.gz
noscript-6ffe07f8f6453d201005fae0a28299cb7ddec15b.tar.xz
noscript-6ffe07f8f6453d201005fae0a28299cb7ddec15b.zip
Reduced noise from tld.js regular expressions generation.
Diffstat (limited to 'TLD/generate.sh')
-rw-r--r--TLD/generate.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/TLD/generate.sh b/TLD/generate.sh
index b05af33..9ccace7 100644
--- a/TLD/generate.sh
+++ b/TLD/generate.sh
@@ -1,16 +1,19 @@
#!/bin/bash
BASE=$(dirname "$0")
+TEMPLATE=tld_template.js
if [ -f "$1" ]; then
- cp "$1" "$BASE/tld_template.js"
+ cp "$1" "$BASE/$TEMPLATE"
fi
-pushd "$BASE"
+pushd "$BASE" >/dev/null
fname=public_suffix_list.dat
nflag=""
if [ -f "$fname" ]; then
nflag="-z $fname"
+ cp "$fname" "$fname.bak"
fi
+echo 'Updating TLDs...'
URL=https://publicsuffix.org/list/$fname
-curl -O $nflag "$URL"
+curl -sO $nflag "$URL"
if ! grep 'com' "$fname" >/dev/null; then
echo >&2 "$fname empty or corrupt!"
@@ -18,4 +21,5 @@ if ! grep 'com' "$fname" >/dev/null; then
fi
./generate.pl
-popd
+[ -f "$fname.bak" ] && diff "$fname" "$fname.bak" && echo 'No new data from pubblic suffix list.'
+popd >/dev/null