new port: www/adzap2squirm

adzap2Squirm is a Perl script to take an Ad Zapper pattern
	file (or the original Ad Zapper script itself, which includes
	the patterns) and write out a corresponding file of patterns
	which Squirm can use for ad zapping.  This port also includes
	a modified update-zapper (from the Ad Zapper) so that updates
	of the ad definitions can be run through cron

PR:		ports/56359
Submitted by:	rmuir@radford.edu
This commit is contained in:
Edwin Groothuis 2004-01-08 01:43:26 +00:00
parent 10ec98c1f3
commit dc0cb7ddc0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=97630
9 changed files with 153 additions and 0 deletions

View File

@ -8,6 +8,7 @@
SUBDIR += abcache
SUBDIR += admuser
SUBDIR += adzap
SUBDIR += adzap2squirm
SUBDIR += amaya
SUBDIR += amyc
SUBDIR += analog

49
www/adzap2squirm/Makefile Normal file
View File

@ -0,0 +1,49 @@
# New ports collection makefile for: adzap2squirm
# Date created: 02 Sept 2003
# Whom: Robert Muir <rmuir@radford.edu>
#
# $FreeBSD$
#
PORTNAME= adzap2squirm
PORTVERSION= 1.0
CATEGORIES= www
MASTER_SITES= http://www.meredevice.com/files/ \
http://adzapper.sourceforge.net/scripts/
DISTFILES= adzap2squirm a2swrap update-zapper
EXTRACT_ONLY=
MAINTAINER= ports@FreeBSD.org
COMMENT= Use and update adzap patterns with squirm
RUN_DEPENDS= squirm:${PORTSDIR}/www/squirm
USE_REINPLACE= yes
USE_PERL5_RUN= yes
NO_BUILD= yes
PKGMESSAGE= ${WRKDIR}/pkg-message
do-extract:
${MKDIR} ${WRKSRC}
${CP} ${FILESDIR}/pkg-message ${PKGMESSAGE}
.for DISTFILE in ${DISTFILES}
${CP} ${DISTDIR}/${DISTFILE} ${WRKSRC}
.endfor
post-patch:
${REINPLACE_CMD} -e "s,%%PREFIX%%,${PREFIX},g" ${WRKSRC}/a2swrap
${REINPLACE_CMD} -e "s,%%PREFIX%%,${PREFIX},g" ${PKGMESSAGE}
${REINPLACE_CMD} \
-e "s,%%PREFIX%%,${PREFIX},g" \
-e "s,%%FETCH_CMD%%,${FETCH_CMD},g" \
${WRKSRC}/update-zapper
do-install:
.for DISTFILE in ${DISTFILES}
${INSTALL_SCRIPT} ${WRKSRC}/${DISTFILE} ${PREFIX}/bin
.endfor
${INSTALL} ${FILESDIR}/squirm.conf.zap ${PREFIX}/etc/squirm/
${TOUCH} ${PREFIX}/etc/squirm/zap.patterns
${CAT} ${WRKDIR}/pkg-message
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
MD5 (a2swrap) = 3ef099d66d5470d367f2ba11533b0cfa
MD5 (adzap2squirm) = 67e2dc0812b523ae8c161c5af6d7f46b
MD5 (update-zapper) = 60ddf676f5a6654481cb9b547151308e

View File

@ -0,0 +1,39 @@
--- a2swrap.orig Fri Jul 18 20:57:46 2003
+++ a2swrap Tue Sep 2 21:48:35 2003
@@ -19,10 +19,10 @@
#
#ZAP_BASE: the base URL for the replacement files.
# DEFAULT: http://adzap.cs.zip.com.au
-export ZAP_BASE=http://192.168.0.10/zaps
+# export ZAP_BASE=http://192.168.0.10/zaps
#ZAP_BASE_SSL: the base URL for replacement files via HTTPS
# DEFAULT: https://adzap.cs.zip.com.au
-export ZAP_BASE_SSL=http://192.168.0.10/zaps
+# export ZAP_BASE_SSL=http://192.168.0.10/zaps
#STUBURL_*: replacement URLs for the various classes recognized
# by adzapper
# DEFAULT: same as the adzapper defaults
@@ -30,7 +30,7 @@
# this would be the latest version of the adzapper script as downloaded
# from the homepage.
# default: squid_redirect
-export A2S_PTNFILE=patterns
+# export A2S_PTNFILE=patterns
#A2S_PREFILE: a filename to read for patterns before the main pattern
# file. If the file is not present it will be silently skipped.
# DEFAULT: prezap
@@ -42,7 +42,7 @@
#A2S_OUTFILE: the filename to which the Squirm configuration will be
# written.
# DEFAULT: squirm.patterns
-export A2S_OUTFILE=/usr/local/squirm/etc/squirm.patterns
+export A2S_OUTFILE=%%PREFIX%%/etc/squirm/zap.patterns
#A2S_CREATEACCELS: set to "false" to disable the creation of accelerator
# strings for Squirm. Note that since v1.23, Squirm attempts to create
# accelerators for patterns which do not have them specified in the pattern
@@ -60,4 +60,4 @@
export ZAP_MODE="CLEAR"
-./adzap2squirm
+%%PREFIX%%/bin/adzap2squirm

View File

@ -0,0 +1,23 @@
--- update-zapper.orig Sun Jan 5 05:28:38 2003
+++ update-zapper Tue Sep 2 23:01:53 2003
@@ -8,15 +8,16 @@
#
masterurl=http://adzapper.sourceforge.net/scripts/squid_redirect
-zapper=/usr/local/etc/squid_redirect ## hack to suit your site
-pidfile=/var/run/squid-noads.pid ## hack to suit, again
+zapper=%%PREFIX%%/etc/squirm/squid_redirect ## hack to suit your site
+pidfile=%%PREFIX%%/squid/logs/squid.pid ## hack to suit, again
tmp=/tmp/newzapper$$
-if wget -q --cache=off -O $tmp "$masterurl"
+if %%FETCH_CMD%% -q -o $tmp "$masterurl"
then
[ ! -s "$tmp" ] \
|| cmp -s "$tmp" "$zapper" \
- || ( cat "$tmp" >"$zapper" || exit 1
+ || ( cat "$tmp" | sed -e "s@\|)@\|\.\*)@g" -e "s@(\|@(\.\*\|@g" >"$zapper" || exit 1
+ (cd %%PREFIX%%/etc/squirm && %%PREFIX%%/bin/a2swrap)
[ -s "$pidfile" ] && kill -1 `cat "$pidfile"`
)
fi

View File

@ -0,0 +1,20 @@
********************************************************
In order to block ads, you must first setup squirm.conf
An example is in:
%%PREFIX%%/etc/squirm/squirm.conf.zap
You must also setup squid to use squirm if you have not
done so. Add this to %%PREFIX%%/etc/squid/squid.conf:
redirect_program: %%PREFIX%%/bin/squirm
Then run from the command line:
%%PREFIX%%/bin/update-zapper
This port installs a script (%%PREFIX%%/update-zapper)
which will update the ad definitions, and restart squid
if there are new ones available. Add this to root's
crontab to easily keep your ad definitions up to date.
********************************************************

View File

@ -0,0 +1,7 @@
begin
network 127.0.0.0/24
# ADD YOUR NETWORKS HERE
log squirm/logs/match.log
abort-log squirm/logs/abort.log
pattern zap.patterns get
end

View File

@ -0,0 +1,6 @@
Adzap2Squirm is a Perl script to take an Ad Zapper pattern file
(or the original Ad Zapper script itself, which includes the patterns)
and write out a corresponding file of patterns which Squirm can use for
ad zapping.
WWW: http://www.meredevice.com/adzap2squirm.html

View File

@ -0,0 +1,5 @@
bin/a2swrap
bin/adzap2squirm
bin/update-zapper
etc/squirm/squirm.conf.zap
etc/squirm/zap.patterns