fanboy-adblock/scripts/firefox/fanboy-element-opera-generator.sh

70 lines
2.2 KiB
Bash
Raw Normal View History

2011-12-10 22:57:52 +13:00
#!/bin/bash
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:21:34 +12:00
# Fanboy Dimensions Adblock list grabber script v2.0 (08/09/2012)
2011-05-26 20:36:26 +12:00
# Dual License CCby3.0/GPLv2
# http://creativecommons.org/licenses/by/3.0/
# http://www.gnu.org/licenses/gpl-2.0.html
#
2012-09-08 21:21:34 +12: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"
# Add New line
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:21:34 +12:00
sed -e '$a\' $HGSERV/opera/opera-header.txt > $TESTDIR/opera-header.txt
2012-09-08 21:42:40 +12:00
sed -e '$a\' $HGSERV/fanboy-adblock/fanboy-elements-generic.txt > $TESTDIR/fanboy-elements-generic2.txt
# Remove top lines
#
sed '1,3d' $TESTDIR/fanboy-elements-generic2.txt > $TESTDIR/fanboy-elements-generic.txt
2011-05-26 20:36:26 +12:00
2012-09-08 21:21:34 +12:00
# the magic, remove ## and #. and add , to each line
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:21:34 +12:00
cat $TESTDIR/fanboy-elements-generic.txt | sed 's/^..\(.*\)$/\1,/' > $TESTDIR/fanboy-css.txt
2011-05-26 20:36:26 +12:00
2012-09-08 21:21:34 +12:00
# Combine
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:21:34 +12:00
cat $TESTDIR/opera-header.txt $TESTDIR/fanboy-css.txt $HGSERV/other/opera-addon.css > $TESTDIR/opera-addon.css
2011-05-26 20:36:26 +12:00
# Remove selected lines (be very specific, include comma)
2012-09-08 21:21:34 +12:00
# sed -i '/#testfilter,/d' $TESTDIR/opera-addon.css
sed -i '/.ad-vertical-container/d' $TESTDIR/opera-addon.css
2011-06-11 14:20:37 +12:00
# Remove any trailing blank lines, or blank lines in front
#
sed -i -e 's/^[ \t]*//;s/[ \t]*$//' $TESTDIR/opera-addon.css
2012-09-08 21:21:34 +12:00
# Remove empty lines
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:21:34 +12:00
sed -i -e '/^$/d' $TESTDIR/opera-addon.css
2011-05-26 20:36:26 +12:00
2012-09-08 21:21:34 +12:00
# Checksum
#
$ADDCHECKSUM $TESTDIR/opera-addon.css
2011-05-26 20:36:26 +12:00
2012-09-08 21:21:34 +12:00
# Compress
2011-05-26 20:36:26 +12:00
#
2012-09-08 21:42:40 +12:00
cp -f $TESTDIR/opera-addon.css $MAINDIR/opera/fanboy-adblocklist-elements-v4.css
rm -rf $MAINDIR/opera/fanboy-adblocklist-elements-v4.css.gz
$ZIP $MAINDIR/opera/fanboy-adblocklist-elements-v4.css.gz $TESTDIR/opera-addon.css > /dev/null
2011-12-10 22:57:52 +13:00
2012-09-08 21:21:34 +12:00
# Remove temp files
#
2012-09-08 21:42:40 +12:00
rm -rf $TESTDIR/opera-header.txt $TESTDIR/fanboy-elements-generic.txt $TESTDIR/fanboy-css.txt $TESTDIR/opera-addon.css $TESTDIR/fanboy-elements-generic2.txt