summaryrefslogtreecommitdiff
path: root/TLD/generate.sh
blob: b05af33657dad62d5189b987ecf79033816e7f6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
BASE=$(dirname "$0")
if [ -f "$1" ]; then
  cp "$1" "$BASE/tld_template.js"
fi
pushd "$BASE"
fname=public_suffix_list.dat
nflag=""
if [ -f "$fname" ]; then
  nflag="-z $fname"
fi
URL=https://publicsuffix.org/list/$fname
curl -O $nflag "$URL"

if ! grep 'com' "$fname" >/dev/null; then
  echo >&2 "$fname empty or corrupt!"
  exit 1
fi

./generate.pl
popd