1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-06 02:42:33 +01:00
uBlock/assets/update-3p-mirror.sh

31 lines
998 B
Bash
Raw Normal View History

2015-01-15 16:36:15 +01:00
#!/bin/bash
#
# 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/mirror1.malwaredomains.com/files/immortal_domains.txt']='http://mirror1.malwaredomains.com/files/immortal_domains.txt'
['thirdparties/mirror1.malwaredomains.com/files/justdomains']='http://mirror1.malwaredomains.com/files/justdomains'
['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