fanboy-adblock/scripts/ie/adblock-ie-generator.sh

108 lines
5.1 KiB
Bash
Raw Normal View History

2011-04-17 15:14:25 +12:00
#!/bin/bash
#
# Fanboy Adblock IE Convert script v1.3 (16/04/2012)
2011-04-17 15:14:25 +12:00
# Dual License CCby3.0/GPLv2
# http://creativecommons.org/licenses/by/3.0/
# http://www.gnu.org/licenses/gpl-2.0.html
#
# Creating a 10Mb ramdisk Temp storage...
#
if [ ! -d "/tmp/ieramdisk/" ]; then
2011-04-17 15:18:42 +12:00
rm -rf /tmp/ieramdisk/
2011-04-17 15:14:25 +12:00
mkdir /tmp/ieramdisk; chmod 777 /tmp/ieramdisk
mount -t tmpfs -o size=10M tmpfs /tmp/ieramdisk/
2011-04-29 21:31:23 +12:00
cp -f /home/fanboy/google/fanboy-adblock-list/scripts/ie/combineSubscriptions.py /tmp/ieramdisk/
2011-04-17 15:14:25 +12:00
mkdir /tmp/ieramdisk/subscriptions
fi
# Variables
#
MAINDIR="/var/www/adblock"
GOOGLEDIR="/home/fanboy/google/fanboy-adblock-list"
2011-04-17 15:14:25 +12:00
ZIP="/usr/local/bin/7za"
IEDIR="/tmp/ieramdisk"
SUBS="/tmp/ieramdisk/subscriptions"
# Clear out any old files lurking
#
2012-04-16 23:26:54 +12:00
rm -rf $IEDIR/*.txt $SUBS/*
2011-04-29 21:29:30 +12:00
cd $IEDIR
2011-04-17 15:14:25 +12:00
# Copy TPL (Microsoft IE9) Script
#
2011-04-29 20:16:54 +12:00
# cp -f /root/maketpl.pl $IEDIR
2011-04-17 15:14:25 +12:00
# Cleanup fanboy-adblock-addon.txt (remove the top 8 lines)
#
sed '1,8d' $GOOGLEDIR/ie/fanboy-adblock-addon.txt > $IEDIR/fanboy-adblock-addon.txt
2011-04-17 18:10:12 +12:00
2011-04-17 15:14:25 +12:00
# Merge with Google-code (IE adblock addon)
#
cat $MAINDIR/fanboy-adblock-noele.txt $IEDIR/fanboy-adblock-addon.txt > $IEDIR/fanboy-noele.txt
# IE Ultimate and Complete
#
cat $IEDIR/fanboy-noele.txt $MAINDIR/fanboy-ultimate-ie.txt > $IEDIR/fanboy-ultimate-ie.txt
cat $IEDIR/fanboy-noele.txt $MAINDIR/fanboy-complete-ie.txt > $IEDIR/fanboy-complete-ie.txt
2011-04-17 15:14:25 +12:00
# Remove Old files
#
rm -rf $IEDIR/fanboy-adblock-noele.txt $IEDIR/fanboy-adblock-addon.txt
# Remove ~third-party
#
sed -i '/~third-party/d' $IEDIR/fanboy-noele.txt $IEDIR/fanboy-ultimate-ie.txt $IEDIR/fanboy-complete-ie.txt
2011-04-17 15:14:25 +12:00
# Generate .tpl IE list
#
2011-04-29 20:16:54 +12:00
# perl $IEDIR/maketpl.pl &> /dev/null
2012-05-13 21:45:13 +12:00
python $IEDIR/combineSubscriptions.py $IEDIR $SUBS
2011-04-17 15:14:25 +12:00
# Now remove filters that cause issues in IE (and false positives)
#
2012-05-16 00:30:33 +12:00
sed -i '10,20000{/\#/d}' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '10,20000{/#/d}' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d atdmt.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d 247realmedia.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d googlesyndication.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d scorecardresearch.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d oascentral.thechronicleherald.ca/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d au.adserver.yahoo.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d adserver.yahoo.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d skimlinks.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ad-emea.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ad.au.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d spotxchange.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
2012-05-16 00:48:51 +12:00
sed -i '/adf.ly/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ad-emea.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d g.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d pagead2.googlesyndication.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d partner.googleadservices.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ads.yimg.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ad.ca.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d ad.doubleclick.net/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
sed -i '/+d zedo.com/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
2012-02-18 12:33:49 +13:00
# http://hg.fanboy.co.nz/rev/5760d7c3afb3
sed -i '/&adsType=/d' $SUBS/fanboy-noele.tpl $SUBS/fanboy-ultimate-ie.tpl $SUBS/fanboy-complete-ie.tpl
2011-04-17 15:14:25 +12:00
2012-05-16 00:30:33 +12:00
2011-04-17 15:14:25 +12:00
# Remove old gz file
#
rm -f $SUBS/fanboy-noele.tpl*.gz
rm -f $SUBS/fanboy-ultimate-*.gz
rm -f $SUBS/fanboy-complete-*.gz
2011-04-17 15:14:25 +12:00
# Re-compress newly modified file
#
$ZIP a -mx=9 -y -tgzip $SUBS/fanboy-noele.tpl.gz $SUBS/fanboy-noele.tpl > /dev/null
$ZIP a -mx=9 -y -tgzip $SUBS/fanboy-ultimate-ie.tpl.gz $SUBS/fanboy-ultimate-ie.tpl > /dev/null
$ZIP a -mx=9 -y -tgzip $SUBS/fanboy-complete-ie.tpl.gz $SUBS/fanboy-complete-ie.tpl > /dev/null
2011-04-17 15:14:25 +12:00
# Now copy finished tpl list to the website.
#
cp -f $SUBS/fanboy-noele.tpl* $MAINDIR/ie/
2012-04-16 23:47:27 +12:00
cp -f $SUBS/fanboy-ultimate-ie.tpl* $MAINDIR/ie/
cp -f $SUBS/fanboy-complete-ie.tpl* $MAINDIR/ie/