fanboy-adblock/scripts/firefox2opera.sh

91 lines
3.0 KiB
Bash
Raw Normal View History

2012-05-20 22:34:49 +12:00
#!/bin/bash
#
2012-10-11 23:58:09 +13:00
# Fanboy Adblock list Firefox-Opera bash script v2.0 (11/10/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-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"
export MAINDIR="/tmp/Ramdisk/www/adblock"
export SPLITDIR="/tmp/Ramdisk/www/adblock/split/test"
export HGSERV="/tmp/hgstuff/fanboy-adblock-list"
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"
export IEDIR="/tmp/work/ie"
export IESUBS="/tmp/work/ie/subscriptions"
export IRONDIR="/tmp/Ramdisk/www/adblock/iron"
export PERL="/usr/bin/perl"
# Check mirror dir exists and its not a symlink
2012-07-15 00:27:44 +12:00
#
2012-10-11 23:58:09 +13:00
if [ -d "/var/hgstuff/fanboy-adblock-list" ] && [ -h "/tmp/hgstuff" ]; then
export HGSERV="/var/hgstuff/fanboy-adblock-list"
echo "HGSERV=/var/hgstuff/fanboy-adblock-list"
cd /tmp/hgstuff/fanboy-adblock-list
$NICE $HG pull
$NICE $HG update
else
# If not, its stored here
export HGSERV="/tmp/hgstuff/fanboy-adblock-list"
echo "HGSERV=/tmp/hgstuff/fanboy-adblock-list"
cd /tmp/hgstuff/fanboy-adblock-list
$NICE $HG pull
$NICE $HG update
2012-08-19 03:27:12 +12:00
fi
# Check that the www server is up before proceding
2012-05-20 22:34:49 +12:00
#
2012-10-11 23:58:09 +13:00
if [ ! -d "/tmp/Ramdisk/www/adblock" ]; then
2012-05-20 22:34:49 +12:00
2012-08-19 03:27:12 +12:00
# Fanboy-Adblock
#
2012-10-11 23:58:09 +13:00
$NICE $PERL $HGSERV/scripts/createOperaFilters_new.pl --nocss $MAINDIR/fanboy-adblock.txt --urlfilter $MAINDIR/opera/urlfilter-adblock.bak
# Fanboy-Tracking
#
$NICE $PERL $HGSERV/scripts/createOperaFilters_new.pl --nocss $MAINDIR/fanboy-tracking.txt --urlfilter $MAINDIR/opera/urlfilter-tracking.bak
2012-05-20 22:34:49 +12:00
2012-10-11 23:58:09 +13:00
# Include Opera urlfilter header file
2012-08-19 03:27:12 +12:00
#
2012-10-11 23:58:09 +13:00
$CAT $HGSERV/opera/urlfilter-header.txt $MAINDIR/opera/urlfilter-adblock.bak > $MAINDIR/opera/urlfilter-adblock.bak2
$CAT $HGSERV/opera/urlfilter-header.txt $MAINDIR/opera/urlfilter-tracking.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
$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
$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-10-11 23:58:09 +13:00
rm -rf $MAINDIR/opera/urlfilter-tracking.bak* $MAINDIR/opera/urlfilter-adblock.bak*
2012-08-19 03:27:12 +12:00
fi
2012-05-20 22:34:49 +12:00