aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarga <garga@FreeBSD.org>2005-08-30 01:29:39 +0800
committergarga <garga@FreeBSD.org>2005-08-30 01:29:39 +0800
commitb925a74646a9117b1560e2cc1d05933b278d25a1 (patch)
treec34232b0024d7fc79cb9bd0dca6c382090d2bec2
parentd6b64413f6915d62e69aee34de836e1e90786fac (diff)
downloadfreebsd-ports-gnome-b925a74646a9117b1560e2cc1d05933b278d25a1.tar.gz
freebsd-ports-gnome-b925a74646a9117b1560e2cc1d05933b278d25a1.tar.zst
freebsd-ports-gnome-b925a74646a9117b1560e2cc1d05933b278d25a1.zip
Add bannerfilter 1.31, a squid redirect script for filtering web
banners. PR: ports/84915 Submitted by: Emanuel Haupt <ehaupt@critical.ch>
-rw-r--r--www/Makefile1
-rw-r--r--www/bannerfilter/Makefile72
-rw-r--r--www/bannerfilter/distinfo2
-rw-r--r--www/bannerfilter/files/patch-update.sh138
-rw-r--r--www/bannerfilter/pkg-descr8
-rw-r--r--www/bannerfilter/pkg-plist47
6 files changed, 268 insertions, 0 deletions
diff --git a/www/Makefile b/www/Makefile
index 738547af6644..fd98507493fe 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -42,6 +42,7 @@
SUBDIR += awstats
SUBDIR += axis
SUBDIR += b2evo
+ SUBDIR += bannerfilter
SUBDIR += bblog
SUBDIR += bins
SUBDIR += bk2site
diff --git a/www/bannerfilter/Makefile b/www/bannerfilter/Makefile
new file mode 100644
index 000000000000..db945468c222
--- /dev/null
+++ b/www/bannerfilter/Makefile
@@ -0,0 +1,72 @@
+# New ports collection makefile for: bannerfilter
+# Date created: 14 Aug 2005
+# Whom: Emanuel Haupt <ehaupt@critical.ch>
+#
+# $FreeBSD$
+#
+
+PORTNAME= bannerfilter
+PORTVERSION= 1.31
+CATEGORIES= www
+MASTER_SITES= http://phroggy.com/files/unix/
+
+MAINTAINER= ehaupt@critical.ch
+COMMENT= A squid redirect script for filtering web banners
+
+RUN_DEPENDS= squid:${PORTSDIR}/www/squid
+
+USE_PERL5= yes
+USE_REINPLACE= yes
+NO_BUILD= yes
+
+WWW_ROOT?= www
+PLIST_SUB+= WWW_ROOT="${WWW_ROOT}"
+CONFIG_FILES= bannerfilter.conf banners.data banners.local.data \
+ exceptions.data exceptions.local.data frames.data \
+ frames.local.data popups.data popups.local.data
+
+.include <bsd.port.pre.mk>
+
+.if ${PERL_LEVEL} < 500806
+IGNORE= needs Perl 5.8.6 or above (lang/perl5.8)
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e \
+ 's|/usr/local/etc|${PREFIX}/etc|; s|/usr/bin/perl|${PERL}|' \
+ ${WRKSRC}/redirector.pl
+ @${REINPLACE_CMD} -e \
+ 's|^;\ \(DATA\ =\ \).*|\1${PREFIX}/etc/${PORTNAME}/|' \
+ ${WRKSRC}/${PORTNAME}.conf
+ @${REINPLACE_CMD} -e \
+ 's|^\(CONFIGDIR=\).*|\1"${PREFIX}/etc/${PORTNAME}"|' \
+ ${WRKSRC}/update.sh
+
+do-install:
+ ${MKDIR} ${PREFIX}/libexec/${PORTNAME}
+ ${INSTALL_SCRIPT} ${WRKSRC}/redirector.pl ${PREFIX}/libexec/${PORTNAME}
+ ${INSTALL_SCRIPT} ${WRKSRC}/update.sh \
+ ${PREFIX}/bin/update-bannerfilter-rules
+ ${MKDIR} ${PREFIX}/etc/${PORTNAME}
+.for f in ${CONFIG_FILES}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f}.default
+.if !exists(${PREFIX}/etc/${PORTNAME}/${f})
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}
+.endif
+.endfor
+ ${CP} -R ${WRKSRC}/www ${PREFIX}/${WWW_ROOT}/${PORTNAME}
+
+post-install:
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "==========================================================================="
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "Please add the following redirector config directive to your squid.conf:"
+ @${ECHO_MSG} " redirect_program ${PREFIX}/libexec/bannerfilter/redirector.pl"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "Make sure ${PREFIX}/${WWW_ROOT}/${PORTNAME} is available under"
+ @${ECHO_MSG} " http://localhost/${PORTNAME}"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "==========================================================================="
+ @${ECHO_MSG} ""
+
+.include <bsd.port.post.mk>
diff --git a/www/bannerfilter/distinfo b/www/bannerfilter/distinfo
new file mode 100644
index 000000000000..28df431cccd6
--- /dev/null
+++ b/www/bannerfilter/distinfo
@@ -0,0 +1,2 @@
+MD5 (bannerfilter-1.31.tar.gz) = 329a8a6e2b04b21a6f77a365e62e0881
+SIZE (bannerfilter-1.31.tar.gz) = 36294
diff --git a/www/bannerfilter/files/patch-update.sh b/www/bannerfilter/files/patch-update.sh
new file mode 100644
index 000000000000..0d959b31e47d
--- /dev/null
+++ b/www/bannerfilter/files/patch-update.sh
@@ -0,0 +1,138 @@
+--- update.sh.orig Mon May 31 23:52:25 2004
++++ update.sh Sun Aug 14 17:51:57 2005
+@@ -21,14 +21,21 @@
+ # running as, or if you don't have killall, change RELOAD to 0.
+
+ # Choose your HTTP downloader:
+-CMD="lynx -source"
++# CMD="lynx -source"
+ # CMD="wget -q -O -"
+ # CMD="curl -s"
++CMD="fetch -q -o -"
+
+ # Reload with "killall -HUP redirector.pl" if the files have changed?
+ RELOAD=1
+ # RELOAD=0
+
++# Directory with the data files
++CONFIGDIR="/usr/local/etc/bannerfilter"
++
++# temp dir
++TEMPDIR="/tmp"
++
+ ##########################################################################
+
+ # Earliest version of BannerFilter compatible with your data files:
+@@ -37,18 +44,18 @@
+ # Read the data files from the current directory, and get the modification
+ # date from each. Redirect errors to /dev/null. If the files don't exist,
+ # we get blank values.
+-OLDBANNERS=`grep "^# last modified " banners.data 2>/dev/null|cut -d " " -f4`
+-OLDPOPUPS=`grep "^# last modified " popups.data 2>/dev/null|cut -d " " -f4`
+-OLDFRAMES=`grep "^# last modified " frames.data 2>/dev/null|cut -d " " -f4`
+-OLDEXCEPTIONS=`grep "^# last modified " exceptions.data 2>/dev/null|cut -d " " -f4`
++OLDBANNERS=`grep "^# last modified " $CONFIGDIR/banners.data 2>/dev/null|cut -d " " -f4`
++OLDPOPUPS=`grep "^# last modified " $CONFIGDIR/popups.data 2>/dev/null|cut -d " " -f4`
++OLDFRAMES=`grep "^# last modified " $CONFIGDIR/frames.data 2>/dev/null|cut -d " " -f4`
++OLDEXCEPTIONS=`grep "^# last modified " $CONFIGDIR/exceptions.data 2>/dev/null|cut -d " " -f4`
+
+ # Get the earliest version of BannerFilter compatible with the
+ # new data files, and see whether we need to upgrade
+-$CMD http://phroggy.com/bannerfilter/version.txt>version.tmp \
++$CMD http://phroggy.com/bannerfilter/version.txt> $TEMPDIR/version.tmp \
+ || { echo "Error retrieving version.txt"; exit; }
+-if ( grep "^version " version.tmp>/dev/null ); then
+- NEW=`grep "^version " version.tmp|cut -d " " -f2`
+- rm version.tmp
++if ( grep "^version " $TEMPDIR/version.tmp>/dev/null ); then
++ NEW=`grep "^version " $TEMPDIR/version.tmp|cut -d " " -f2`
++ rm $TEMPDIR/version.tmp
+ else
+ echo "Error: something unexpected in version.txt"
+ exit
+@@ -64,55 +71,63 @@
+
+ # Download all four data files
+
+-$CMD http://phroggy.com/bannerfilter/banners.data>banners.data.tmp \
+-&& grep "^# banners.data$" banners.data.tmp>/dev/null \
++$CMD http://phroggy.com/bannerfilter/banners.data>$CONFIGDIR/banners.data.tmp \
++&& grep "^# banners.data$" $CONFIGDIR/banners.data.tmp>/dev/null \
+ || { echo "Error retrieving banners.data"; exit; }
+
+-$CMD http://phroggy.com/bannerfilter/popups.data>popups.data.tmp \
+-&& grep "^# popups.data$" popups.data.tmp>/dev/null \
++$CMD http://phroggy.com/bannerfilter/popups.data>$CONFIGDIR/popups.data.tmp \
++&& grep "^# popups.data$" $CONFIGDIR/popups.data.tmp>/dev/null \
+ || { echo "Error retrieving popups.data"; exit; }
+
+-$CMD http://phroggy.com/bannerfilter/frames.data>frames.data.tmp \
+-&& grep "^# frames.data$" frames.data.tmp>/dev/null \
++$CMD http://phroggy.com/bannerfilter/frames.data>$CONFIGDIR/frames.data.tmp \
++&& grep "^# frames.data$" $CONFIGDIR/frames.data.tmp>/dev/null \
+ || { echo "Error retrieving frames.data"; exit; }
+
+-$CMD http://phroggy.com/bannerfilter/exceptions.data>exceptions.data.tmp \
+-&& grep "^# exceptions.data$" exceptions.data.tmp>/dev/null \
++$CMD http://phroggy.com/bannerfilter/exceptions.data>$CONFIGDIR/exceptions.data.tmp \
++&& grep "^# exceptions.data$" $CONFIGDIR/exceptions.data.tmp>/dev/null \
+ || { echo "Error retrieving exceptions.data"; exit; }
+
+ # Get the modification dates of the files we just downloaded, compare
+ # them to what we already have, and only overwrite if necessary.
+ # By using cat to overwrite, we preserve ownership and permissions.
+
+-NEWBANNERS=`grep "^# last modified " banners.data.tmp|cut -d " " -f4`
+-NEWPOPUPS=`grep "^# last modified " popups.data.tmp|cut -d " " -f4`
+-NEWFRAMES=`grep "^# last modified " frames.data.tmp|cut -d " " -f4`
+-NEWEXCEPTIONS=`grep "^# last modified " exceptions.data.tmp|cut -d " " -f4`
++NEWBANNERS=`grep "^# last modified " $CONFIGDIR/banners.data.tmp|cut -d " " -f4`
++NEWPOPUPS=`grep "^# last modified " $CONFIGDIR/popups.data.tmp|cut -d " " -f4`
++NEWFRAMES=`grep "^# last modified " $CONFIGDIR/frames.data.tmp|cut -d " " -f4`
++NEWEXCEPTIONS=`grep "^# last modified " $CONFIGDIR/exceptions.data.tmp|cut -d " " -f4`
+ CHANGED=0
+ if [ "$OLDBANNERS" != "$NEWBANNERS" ]; then
+- cat banners.data.tmp > banners.data
++ cat $CONFIGDIR/banners.data.tmp > $CONFIGDIR/banners.data
+ CHANGED=1
+ fi
+ if [ "$OLDPOPUPS" != "$NEWPOPUPS" ]; then
+- cat popups.data.tmp > popups.data
++ cat $CONFIGDIR/popups.data.tmp > $CONFIGDIR/popups.data
+ CHANGED=1
+ fi
+ if [ "$OLDFRAMES" != "$NEWFRAMES" ]; then
+- cat frames.data.tmp > frames.data
++ cat $CONFIGDIR/frames.data.tmp > $CONFIGDIR/frames.data
+ CHANGED=1
+ fi
+ if [ "$OLDEXCEPTIONS" != "$NEWEXCEPTIONS" ]; then
+- cat exceptions.data.tmp > exceptions.data
++ cat $CONFIGDIR/exceptions.data.tmp > $CONFIGDIR/exceptions.data
+ CHANGED=1
+ fi
+
+ # Clean up our temp files
+-rm banners.data.tmp
+-rm popups.data.tmp
+-rm frames.data.tmp
+-rm exceptions.data.tmp
++rm $CONFIGDIR/banners.data.tmp
++rm $CONFIGDIR/popups.data.tmp
++rm $CONFIGDIR/frames.data.tmp
++rm $CONFIGDIR/exceptions.data.tmp
+
+ # Send all instances of redirector.pl a signal to reload the data files
+-if [ $RELOAD == 1 ] && [ $CHANGED == 1 ]; then
+- killall -HUP redirector.pl
++if [ "$RELOAD" = "1" ] && [ "$CHANGED" = "1" ]; then
++ echo -n "Sending signal HUP to all redirector.pl instances... "
++ for pid in $(ps wwwax | grep -i redirector.pl | grep -v grep | awk '{print $1}')
++ do
++ echo -n "$pid "
++ kill -HUP $pid
++ done
++ echo
++else
++ echo "No changes."
+ fi
diff --git a/www/bannerfilter/pkg-descr b/www/bannerfilter/pkg-descr
new file mode 100644
index 000000000000..31c361eed5ff
--- /dev/null
+++ b/www/bannerfilter/pkg-descr
@@ -0,0 +1,8 @@
+BannerFilter is a redirect script for the Squid proxy server, designed to block
+advertising banners on the Web. Unlike most other solutions, it also
+automatically closes popup windows.
+
+WWW: http://phroggy.com/bannerfilter/
+
+- ehaupt
+ehaupt@critical.ch
diff --git a/www/bannerfilter/pkg-plist b/www/bannerfilter/pkg-plist
new file mode 100644
index 000000000000..ffe5c35949e8
--- /dev/null
+++ b/www/bannerfilter/pkg-plist
@@ -0,0 +1,47 @@
+bin/update-bannerfilter-rules
+@unexec if cmp -s %D/etc/bannerfilter/bannerfilter.conf %D/etc/bannerfilter/bannerfilter.conf.default; then rm -f %D/etc/bannerfilter/bannerfilter.conf; fi
+etc/bannerfilter/bannerfilter.conf.default
+@exec [ -f %B/bannerfilter.conf ] || cp %B/%f %B/bannerfilter.conf
+@unexec if cmp -s %D/etc/bannerfilter/banners.data %D/etc/bannerfilter/banners.data.default; then rm -f %D/etc/bannerfilter/banners.data; fi
+etc/bannerfilter/banners.data.default
+@exec [ -f %B/banners.data ] || cp %B/%f %B/banners.data
+@unexec if cmp -s %D/etc/bannerfilter/banners.local.data %D/etc/bannerfilter/banners.local.data.default; then rm -f %D/etc/bannerfilter/banners.local.data; fi
+etc/bannerfilter/banners.local.data.default
+@exec [ -f %B/banners.local.data ] || cp %B/%f %B/banners.local.data
+@unexec if cmp -s %D/etc/bannerfilter/exceptions.data %D/etc/bannerfilter/exceptions.data.default; then rm -f %D/etc/bannerfilter/exceptions.data; fi
+etc/bannerfilter/exceptions.data.default
+@exec [ -f %B/exceptions.data ] || cp %B/%f %B/exceptions.data
+@unexec if cmp -s %D/etc/bannerfilter/exceptions.local.data %D/etc/bannerfilter/exceptions.local.data.default; then rm -f %D/etc/bannerfilter/exceptions.local.data; fi
+etc/bannerfilter/exceptions.local.data.default
+@exec [ -f %B/exceptions.local.data ] || cp %B/%f %B/exceptions.local.data
+@unexec if cmp -s %D/etc/bannerfilter/frames.data %D/etc/bannerfilter/frames.data.default; then rm -f %D/etc/bannerfilter/frames.data; fi
+etc/bannerfilter/frames.data.default
+@exec [ -f %B/frames.data ] || cp %B/%f %B/frames.data
+@unexec if cmp -s %D/etc/bannerfilter/frames.local.data %D/etc/bannerfilter/frames.local.data.default; then rm -f %D/etc/bannerfilter/frames.local.data; fi
+etc/bannerfilter/frames.local.data.default
+@exec [ -f %B/frames.local.data ] || cp %B/%f %B/frames.local.data
+@unexec if cmp -s %D/etc/bannerfilter/popups.data %D/etc/bannerfilter/popups.data.default; then rm -f %D/etc/bannerfilter/popups.data; fi
+etc/bannerfilter/popups.data.default
+@exec [ -f %B/popups.data ] || cp %B/%f %B/popups.data
+@unexec if cmp -s %D/etc/bannerfilter/popups.local.data %D/etc/bannerfilter/popups.local.data.default; then rm -f %D/etc/bannerfilter/popups.local.data; fi
+etc/bannerfilter/popups.local.data.default
+@exec [ -f %B/popups.local.data ] || cp %B/%f %B/popups.local.data
+libexec/bannerfilter/redirector.pl
+%%WWW_ROOT%%/bannerfilter/banner.gif
+%%WWW_ROOT%%/bannerfilter/blocked.html
+%%WWW_ROOT%%/bannerfilter/empty.js
+%%WWW_ROOT%%/bannerfilter/flash.swf
+%%WWW_ROOT%%/bannerfilter/goatsecx.gif
+%%WWW_ROOT%%/bannerfilter/header_tile.gif
+%%WWW_ROOT%%/bannerfilter/hometown.html
+%%WWW_ROOT%%/bannerfilter/namezero.html
+%%WWW_ROOT%%/bannerfilter/nbci.html
+%%WWW_ROOT%%/bannerfilter/null.gif
+%%WWW_ROOT%%/bannerfilter/popup.html
+%%WWW_ROOT%%/bannerfilter/test.html
+%%WWW_ROOT%%/bannerfilter/xbbackground.gif
+%%WWW_ROOT%%/bannerfilter/xoom.html
+%%WWW_ROOT%%/bannerfilter/yahoo.html
+@unexec rmdir %D/etc/bannerfilter 2> /dev/null || true
+@dirrm libexec/bannerfilter
+@dirrm %%WWW_ROOT%%/bannerfilter