2014-11-14 14:59:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This script assumes a linux environment
|
|
|
|
|
2015-04-04 19:54:10 +02:00
|
|
|
TEMPFILE=/tmp/ublock-asset
|
2014-11-14 14:59:16 +01:00
|
|
|
|
|
|
|
echo "*** uBlock: updating remote assets..."
|
|
|
|
|
2015-04-04 19:54:10 +02:00
|
|
|
declare -A assets
|
|
|
|
assets=(
|
|
|
|
['thirdparties/easylist-downloads.adblockplus.org/easylist.txt']='https://easylist-downloads.adblockplus.org/easylist.txt'
|
|
|
|
['thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt']='https://easylist-downloads.adblockplus.org/easyprivacy.txt'
|
|
|
|
['thirdparties/mirror1.malwaredomains.com/files/justdomains']='http://mirror1.malwaredomains.com/files/justdomains'
|
|
|
|
['thirdparties/pgl.yoyo.org/as/serverlist']='http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D=&mimetype=plaintext'
|
|
|
|
['thirdparties/publicsuffix.org/list/effective_tld_names.dat']='https://publicsuffix.org/list/effective_tld_names.dat'
|
2015-12-31 20:34:45 +01:00
|
|
|
['thirdparties/www.malwaredomainlist.com/hostslist/hosts.txt']='https://www.malwaredomainlist.com/hostslist/hosts.txt'
|
2015-04-04 19:54:10 +02:00
|
|
|
)
|
2014-11-14 14:59:16 +01:00
|
|
|
|
2015-04-04 19:54:10 +02:00
|
|
|
for i in "${!assets[@]}"; do
|
|
|
|
localURL="$i"
|
|
|
|
remoteURL="${assets[$i]}"
|
|
|
|
echo "*** Downloading ${remoteURL}"
|
|
|
|
if wget -q -T 30 -O $TEMPFILE -- $remoteURL; then
|
2014-11-14 14:59:16 +01:00
|
|
|
if [ -s $TEMPFILE ]; then
|
2015-04-04 19:54:10 +02:00
|
|
|
if ! cmp -s $TEMPFILE $localURL; then
|
|
|
|
echo " New version found: ${localURL}"
|
2014-11-14 14:59:16 +01:00
|
|
|
if [ "$1" != "dry" ]; then
|
2015-04-04 19:54:10 +02:00
|
|
|
mv $TEMPFILE $localURL
|
2014-11-14 14:59:16 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|