fanboy-adblock/scripts/firefox2opera.sh

133 lines
6.2 KiB
Bash
Raw Normal View History

2012-05-20 22:34:49 +12:00
#!/bin/bash
#
2012-11-09 00:14:28 +13:00
# Fanboy Adblock list Firefox-Opera bash script v2.0 (09/11/2012)
2012-05-20 22:34:49 +12:00
# Dual License CCby3.0/GPLv2
# http://creativecommons.org/licenses/by/3.0/
# http://www.gnu.org/licenses/gpl-2.0.html
#
2012-08-19 03:27:12 +12:00
# Version history
#
2012-11-09 00:14:28 +13:00
# 3.1 Minor bug
2012-10-11 23:58:09 +13:00
# 3.0 Re-write script, cleaner and better, removed lots of cruft.
2012-08-19 03:27:12 +12:00
2012-05-20 22:34:49 +12:00
# Variables for directorys
#
2012-10-11 23:58:09 +13:00
export ZIP="nice -n 19 /usr/local/bin/7za a -mx=9 -y -tgzip"
export NICE="nice -n 19"
export TAC="/usr/bin/tac"
export CAT="/bin/cat"
2013-02-15 13:48:48 +13:00
export MAINDIR="/var/www/adblock"
export SPLITDIR="/var/www/adblock/split/test"
export HGSERV="/root/fanboy-adblock-list"
2012-10-11 23:58:09 +13:00
export TESTDIR="/tmp/work"
export DATE="`date`"
export ADDCHECKSUM="nice -n 19 perl $HGSERV/scripts/addChecksum.pl"
export LOGFILE="/etc/crons/log.txt"
export HG="/usr/local/bin/hg"
export SHA256SUM="/usr/bin/sha256sum"
export TWIDGE="/usr/bin/twidge update"
2013-02-15 13:48:48 +13:00
export IEDIR="/var/test/tmp/work/ie"
export IESUBS="/var/test/ie/subscriptions"
export EASYLIST="/root/easylist/easylist/easylistfanboy/fanboy-adblock"
2012-10-11 23:58:09 +13:00
2012-08-19 03:27:12 +12:00
# Check that the www server is up before proceding
2012-05-20 22:34:49 +12:00
#
2013-02-17 09:08:41 +13:00
if [ -d "/var/www/adblock" ]; then
2012-05-20 22:34:49 +12:00
2012-08-19 03:27:12 +12:00
# Fanboy-Adblock
#
2012-10-14 12:38:40 +13:00
$NICE $PERL $HGSERV/scripts/createOperaFilters_new.pl $MAINDIR/fanboy-adblock.txt --urlfilter $MAINDIR/opera/urlfilter-adblock.bak --nocomments --everythingisfirstparty --nocss --ignorewhitelist
2012-11-09 00:14:28 +13:00
$NICE $PERL $HGSERV/scripts/createOperaFilters_new.pl $HGSERV/fanboy-adblock/fanboy-opera-specific.txt --urlfilter $MAINDIR/opera/urlfilter-specific.bak --nocomments --everythingisfirstparty --nocss --ignorewhitelist
2012-10-11 23:58:09 +13:00
# Fanboy-Tracking
#
2012-10-14 12:38:40 +13:00
$NICE $PERL $HGSERV/scripts/createOperaFilters_new.pl $MAINDIR/fanboy-tracking.txt --urlfilter $MAINDIR/opera/urlfilter-tracking.bak --nocomments --everythingisfirstparty --nocss --ignorewhitelist
# Because Tracking list is merged with Adblock, remove the top 5 lines
#
sed -i -e '1,5d' $MAINDIR/opera/urlfilter-tracking.bak
2012-11-09 00:36:08 +13:00
sed -i -e '1,5d' $MAINDIR/opera/urlfilter-specific.bak
2012-05-20 22:34:49 +12:00
2012-10-22 23:25:37 +13:00
# Remove Bad opera filters
#
sed -i -e '/\/adsWrapper\./d' $MAINDIR/opera/urlfilter-adblock.bak
2012-10-23 23:33:46 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=5&t=15558
sed -i -e '/eloqua.com/d' $MAINDIR/opera/urlfilter-tracking.bak
2012-10-25 23:57:40 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&p=40974
sed -i -e '/analytics_prod./d' $MAINDIR/opera/urlfilter-tracking.bak
sed -i -e '/wikia-beacon.com/d' $MAINDIR/opera/urlfilter-tracking.bak
2012-10-26 11:36:24 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=6&t=7043
sed -i -e '/webtrends.com/d' $MAINDIR/opera/urlfilter-tracking.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=15669
sed -i -e '/.php?zoneid=/d' $MAINDIR/opera/urlfilter-adblock.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=15567
sed -i -e '/viglink.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-10-27 15:03:52 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=6840
sed -i -e '/comscore.com/d' $MAINDIR/opera/urlfilter-tracking.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=15711
sed -i -e '/\/logging.js/d' $MAINDIR/opera/urlfilter-tracking.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=15697
sed -i -e '/yumenetworks.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-10-30 22:55:43 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=9849
sed -i -e '/linksynergy.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-10-31 00:25:18 +13:00
# Problematic filter
sed -i -e '/scorecardresearch.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-12-23 13:07:16 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=16666
2012-12-23 14:14:32 +13:00
sed -i -e '/.com\/ads-/d' $MAINDIR/opera/urlfilter-adblock.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=9849&start=10
sed -i -e '/tkqlhce.com/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/anrdoezrs.net/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/jdoqocy.com/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/apmebf.com/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/kqzyfj.com/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/dpbolvw.net/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/apmebf.com/d' $MAINDIR/opera/urlfilter-adblock.bak
sed -i -e '/rover.ebay.com/d' $MAINDIR/opera/urlfilter-tracking.bak
sed -i -e '/amazon.com\/gp\/\*&linkCode/d' $MAINDIR/opera/urlfilter-tracking.bak
sed -i -e '/emjcd.com/d' $MAINDIR/opera/urlfilter-tracking.bak
2012-11-09 00:31:52 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=6&t=15969&p=41651
sed -i -e '/googletagservices.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-11-10 14:49:51 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=15843
sed -i -e '/\*\/advertising\/\*/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-11-14 00:46:05 +13:00
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=6885
sed -i -e '/chitika.com/d' $MAINDIR/opera/urlfilter-adblock.bak
2012-11-17 20:09:43 +13:00
# https://hg.fanboy.co.nz/rev/1480009e909c
sed -i -e '/\*:\/\/ads.\*/d' $MAINDIR/opera/urlfilter-adblock.bak
# http://forums.fanboy.co.nz/forums/viewtopic.php?f=8&t=16117
sed -i -e '/\/analytics_prod./d' $MAINDIR/opera/urlfilter-tracking.bak
2012-11-17 20:09:43 +13:00
2012-10-11 23:58:09 +13:00
# Include Opera urlfilter header file
2012-08-19 03:27:12 +12:00
#
$CAT $HGSERV/opera/urlfilter-header.txt $MAINDIR/opera/urlfilter-adblock.bak $MAINDIR/opera/urlfilter-specific.bak > $MAINDIR/opera/urlfilter-adblock.bak2
# Adblock+Tracking
$CAT $HGSERV/opera/urlfilter-header.txt $MAINDIR/opera/urlfilter-adblock.bak $MAINDIR/opera/urlfilter-tracking.bak $MAINDIR/opera/urlfilter-specific.bak > $MAINDIR/opera/urlfilter-tracking.bak2
2012-05-20 22:34:49 +12:00
2012-10-11 23:58:09 +13:00
# Remove empty lines
2012-08-19 03:27:12 +12:00
#
2012-10-11 23:58:09 +13:00
sed -i -e '/^$/d' $MAINDIR/opera/urlfilter-adblock.bak2
sed -i -e '/^$/d' $MAINDIR/opera/urlfilter-tracking.bak2
2012-05-20 22:34:49 +12:00
2012-10-11 23:58:09 +13:00
# Checksums
2012-08-19 03:27:12 +12:00
#
2012-10-11 23:58:09 +13:00
$PERL $HGSERV/scripts/addChecksum-opera.pl $MAINDIR/opera/urlfilter-adblock.bak2
2012-10-12 00:10:00 +13:00
$PERL $HGSERV/scripts/addChecksum-opera.pl $MAINDIR/opera/urlfilter-tracking.bak2
2012-05-20 22:34:49 +12:00
2012-10-11 23:58:09 +13:00
# GZIP
2012-08-19 03:27:12 +12:00
#
2012-10-11 23:58:09 +13:00
cp -f $MAINDIR/opera/urlfilter-adblock.bak2 $MAINDIR/opera/urlfilter.ini
cp -f $MAINDIR/opera/urlfilter-tracking.bak2 $MAINDIR/opera/complete/urlfilter.ini
# Clear old files first
#
rm -rf $MAINDIR/opera/urlfilter.ini.gz $MAINDIR/opera/complete/urlfilter.ini.gz
2012-10-11 23:58:09 +13:00
$ZIP $MAINDIR/opera/urlfilter.ini.gz $MAINDIR/opera/urlfilter-adblock.bak2 > /dev/null
$ZIP $MAINDIR/opera/complete/urlfilter.ini.gz $MAINDIR/opera/urlfilter-tracking.bak2 > /dev/null
2012-08-19 03:27:12 +12:00
2012-10-11 23:58:09 +13:00
# Remove Backup files
2012-08-19 03:27:12 +12:00
#
2012-11-03 14:50:19 +13:00
rm -rf $MAINDIR/opera/urlfilter-tracking.bak* $MAINDIR/opera/urlfilter-adblock.bak* $MAINDIR/opera/urlfilter-specific.bak*
2012-08-19 03:27:12 +12:00
fi
2012-05-20 22:34:49 +12:00