-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathupdate-tlds.sh
More file actions
executable file
·34 lines (30 loc) · 830 Bytes
/
update-tlds.sh
File metadata and controls
executable file
·34 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Copyright (C) 2021-2024 Giorgio Maone <https://maone.net>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# This script updates common/tld.js with the latest pubblic suffix
# and commits the changes if we've got the right git credentials
BASE="$(dirname "$0")"
SRC="$(realpath "$(dirname "$BASE")")"
REL_JS_PATH="common/tld.js"
if node "$BASE/TLD/update.js" $@; then
echo "Updated TLDs"
else
exit
fi
if [[ -f "$1" ]]; then
# Updated out-of-tree $1, nothing more to do.
exit
fi
if [[ $(git config --get user.name) == "hackademix" ]]; then
echo "Synchronizing nscl git repo."
pushd "$BASE"
if git status --short | grep " M $REL_JS_PATH"; then
git add "$REL_JS_PATH"
git add "TLD/public_suffix_list.dat"
git commit -m'Updated TLDs.'
else
echo "Repo already up-to-date."
fi
popd
fi