1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00
uBlock/assets/update-3p-mirror.sh

29 lines
748 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2015-01-15 16:36:15 +01:00
#
# This script assumes a linux environment
TEMPFILE=/tmp/httpsb-asset
echo "*** uBlock: updating remote assets..."
2015-04-07 21:13:03 +02:00
declare -A assets
assets=(
['thirdparties/publicsuffix.org/list/effective_tld_names.dat']='https://publicsuffix.org/list/effective_tld_names.dat'
)
2015-01-15 16:36:15 +01:00
2015-04-07 21:13:03 +02:00
for i in "${!assets[@]}"; do
localURL="$i"
remoteURL="${assets[$i]}"
echo "*** Downloading ${remoteURL}"
if wget -q -T 30 -O $TEMPFILE -- $remoteURL; then
2015-01-15 16:36:15 +01:00
if [ -s $TEMPFILE ]; then
2015-04-07 21:13:03 +02:00
if ! cmp -s $TEMPFILE $localURL; then
echo " New version found: ${localURL}"
2015-01-15 16:36:15 +01:00
if [ "$1" != "dry" ]; then
2015-04-07 21:13:03 +02:00
mv $TEMPFILE $localURL
2015-01-15 16:36:15 +01:00
fi
fi
fi
fi
done