File: updategoogle.sh

package info (click to toggle)
privacybadger 2020.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 7,044 kB
  • sloc: javascript: 50,267; python: 1,741; sh: 454; makefile: 32
file content (27 lines) | stat: -rwxr-xr-x 772 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash

# stop on errors (nonzero exit codes), uninitialized vars
set -eu

GOOGLE_DOMAINS_URL=https://www.google.com/supported_domains
MANIFEST_PATH=src/manifest.json
TEMPFILE=$(mktemp)

trap 'rm $TEMPFILE' EXIT

echo "fetching Google Search domains ..."
if wget -q -T 30 -O "$TEMPFILE" -- $GOOGLE_DOMAINS_URL && [ -s "$TEMPFILE" ]; then
	./scripts/updategoogle.py "$TEMPFILE" "$MANIFEST_PATH"
	if cmp -s "$TEMPFILE" $MANIFEST_PATH; then
		echo "    no Google Search domain updates"
	else
		cp "$TEMPFILE" $MANIFEST_PATH
		echo "    updated Google Search domains in $MANIFEST_PATH"
		echo "    please verify, update Google's MDFP list, and commit both!"
		exit 1
	fi
else
	echo "    failed to fetch $GOOGLE_DOMAINS_URL"
	echo "    aborting build!"
	exit 1
fi