summaryrefslogtreecommitdiffstats
path: root/scripts/updateseeddata.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:55:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:55:34 +0000
commit75417f5e3d32645859d94cec82255dc130ec4a2e (patch)
tree5fd46925c6b4a881c9208772ed8e5cc0588bc164 /scripts/updateseeddata.sh
parentInitial commit. (diff)
downloadprivacybadger-75417f5e3d32645859d94cec82255dc130ec4a2e.tar.xz
privacybadger-75417f5e3d32645859d94cec82255dc130ec4a2e.zip
Adding upstream version 2020.10.7.upstream/2020.10.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xscripts/updateseeddata.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/updateseeddata.sh b/scripts/updateseeddata.sh
new file mode 100755
index 0000000..bb1d221
--- /dev/null
+++ b/scripts/updateseeddata.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+# Update the pre-trained "seed" tracker list
+
+# stop on errors (nonzero exit codes), uninitialized vars
+set -eu
+
+SEED_PATH=src/data/seed.json
+SEED_URL=https://raw.githubusercontent.com/EFForg/badger-sett/master/results.json
+TEMPFILE=$(mktemp)
+
+trap 'rm $TEMPFILE' EXIT
+
+echo "fetching seed tracker lists..."
+if wget -q -T 30 -O "$TEMPFILE" -- $SEED_URL && [ -s "$TEMPFILE" ]; then
+ if ! python scripts/verify_json.py "$TEMPFILE"; then
+ echo " new seed data is not formatted correctly"
+ echo " aborting build!"
+ exit 1
+ fi
+
+ if cmp -s "$TEMPFILE" $SEED_PATH; then
+ echo " no seed data updates"
+ else
+ cp "$TEMPFILE" $SEED_PATH
+ echo " updated seed data at $SEED_PATH"
+ echo " please verify and commit!"
+ exit 1
+ fi
+else
+ echo " failed to fetch seed data from $SEED_URL"
+ echo " aborting build!"
+ exit 1
+fi