2011-05-26 20:36:26 +12:00
#!/bin/bash
#
# Fanboy Adult Adblock list grabber script v1.0 (26/05/2011)
# Dual License CCby3.0/GPLv2
# http://creativecommons.org/licenses/by/3.0/
# http://www.gnu.org/licenses/gpl-2.0.html
#
# Creating a 20Mb ramdisk Temp storage...
#
if [ ! -d "/tmp/ramdisk/" ] ; then
rm -rf /tmp/ramdisk/
mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk
mount -t tmpfs -o size = 20M tmpfs /tmp/ramdisk/
mkdir /tmp/ramdisk/opera/
fi
# Variables for directorys
#
2012-08-01 17:15:55 +12:00
# MAINDIR="/var/www/adblock"
# GOOGLEDIR="/home/fanboy/google/fanboy-adblock-list"
# TESTDIR="/tmp/ramdisk"
# ZIP="/usr/local/bin/7za"
2011-05-26 20:36:26 +12:00
# Remove Temp files
#
rm -f $TESTDIR /fanboy-adult*.txt
rm -f $TESTDIR /fanboy-adblocklist-current-expanded.txt
cp -f $GOOGLEDIR /fanboy-adblocklist-current-expanded.txt $TESTDIR /fanboy-adblocklist-current-expanded.txt
2011-10-22 01:25:23 +13:00
sed -n '/Adult Blocking Rules/,/1st Party P2P Rules/{/1st Party P2P Rules/!p}' $TESTDIR /fanboy-adblocklist-current-expanded.txt > $TESTDIR /fanboy-adult.txt
2011-05-26 20:36:26 +12:00
sed -n '/Adult Hiding FF 3.x Rules/,/Generic Hiding Rules/{/Generic Hiding Rules/!p}' $TESTDIR /fanboy-adblocklist-current-expanded.txt > $TESTDIR /fanboy-adult-ele.txt
cat $TESTDIR /fanboy-adult.txt $TESTDIR /fanboy-adult-ele.txt > $TESTDIR /fanboy-adult2.txt
sed -e '$d' $TESTDIR /fanboy-adult2.txt > $TESTDIR /fanboy-adult1.txt
2012-08-15 20:54:13 +12:00
cat $MAINDIR /adblock/header-adult.txt $TESTDIR /fanboy-adult1.txt > $TESTDIR /fanboy-adult.txt
perl $TESTDIR /addChecksum.pl $TESTDIR /fanboy-adult.txt
2011-05-26 20:36:26 +12:00
# Compare the Adult List on the website vs mercurial copy
#
2012-08-15 20:54:13 +12:00
if diff $TESTDIR /fanboy-adult.txt $MAINDIR /adblock/fanboy-adult.txt >/dev/null ; then
2011-05-26 20:36:26 +12:00
echo "No Changes detected: fanboy-adult.txt"
else
echo "Updated: fanboy-adult.txt"
2012-08-15 20:54:13 +12:00
cp -f $TESTDIR /fanboy-adult.txt $MAINDIR /adblock/fanboy-adult.txt
rm -f $MAINDIR /adblock/fanboy-adult.txt.gz
$ZIP a -mx= 9 -y -tgzip $MAINDIR /adblock/fanboy-adult.txt.gz $TESTDIR /fanboy-adult.txt > /dev/null
2011-05-26 11:46:18 +12:00
fi