[Midnightbsd-cvs] mports: mports/www: Add polipo, a caching web proxy with ipv6 support.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Apr 12 22:21:51 EDT 2008


Log Message:
-----------
Add polipo, a caching web proxy with ipv6 support.

Modified Files:
--------------
    mports/www:
        Makefile (r1.71 -> r1.72)

Added Files:
-----------
    mports/www/polipo:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
        pkg-plist (r1.1)
    mports/www/polipo/files:
        400.polipo.in (r1.1)
        patch-aa (r1.1)
        pkg-deinstall.in (r1.1)
        pkg-install.in (r1.1)
        pkg-message.in (r1.1)
        polipo.sh.in (r1.1)

-------------- next part --------------
--- /dev/null
+++ www/polipo/pkg-descr
@@ -0,0 +1,6 @@
+Polipo is a small and fast caching web proxy (a web cache, an HTTP proxy)
+designed to be used by one person or a small group of people.
+
+WWW: http://www.pps.jussieu.fr/~jch/software/polipo/
+Author: Juliusz Chroboczek <jch at pps.jussieu.fr>
+WWW: http://www.sax.de/~frank/polipo4bsd/
--- /dev/null
+++ www/polipo/pkg-plist
@@ -0,0 +1,7 @@
+bin/polipo
+etc/polipo/config.sample
+etc/polipo/forbidden.sample
+etc/periodic/daily/400.polipo
+%%PORTDOCS%%%%DATADIR%%/www/index.html
+ at dirrmtry etc/periodic/daily
+ at dirrmtry etc/periodic
--- /dev/null
+++ www/polipo/Makefile
@@ -0,0 +1,75 @@
+# New ports collection makefile for:   polipo
+# Date created:        2005-01-25
+# Whom:                Frank Behrens <frank at pinky.sax.de>
+#
+# $MidnightBSD: mports/www/polipo/Makefile,v 1.1 2008/04/13 02:21:49 laffer1 Exp $
+# $FreeBSD: ports/www/polipo/Makefile,v 1.15 2008/01/10 23:19:14 miwi Exp $
+#
+
+PORTNAME=	polipo
+PORTVERSION=	1.0.4
+CATEGORIES=	www
+MASTER_SITES=	http://www.pps.jussieu.fr/~jch/software/files/polipo/ \
+		http://www.sax.de/~frank/polipo4bsd/files/
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	A small and fast caching web proxy
+LICENSE=	bsd2
+
+MAN1=		polipo.1
+
+USE_RC_SUBR=	polipo.sh
+
+.include <bsd.port.pre.mk>
+
+.if defined(NO_PTEXINFO)
+ALL_TARGET=	polipo
+NOPORTDOCS=	yes
+.else
+INFO=		polipo
+.endif
+
+DOCSDIR=	${DATADIR}/www/doc
+PORTDOCS=	*
+
+SUB_FILES=	pkg-message pkg-install pkg-deinstall 400.polipo
+SUB_LIST+=	USER=${PUSER} GROUP=${PGRP} DESTDIR=${DESTDIR} PCONFIGDIR=${PCONFIGDIR} \
+		PCACHEDIR=${PCACHEDIR} PPIDDIR=${PPIDDIR} PPIDFILE=${PPIDFILE} \
+		PLOGFILE=${PLOGFILE} RC_SUBR=${RC_SUBR}
+
+# polipo installation options, propagated to install scripts
+PUSER?=		polipo
+PGRP?=		polipo
+PCONFIGDIR?=	${PREFIX}/etc/polipo/
+PCACHEDIR?=	/var/cache/polipo
+PPIDDIR?=	/var/run/polipo/
+PPIDFILE=	${PPIDDIR}polipo.pid
+PLOGFILE?=	/var/log/polipo
+MAKE_ENV+=	DISK_CACHE_ROOT=${PCACHEDIR}
+
+pre-install: apply-slist
+	@PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/polipo ${PREFIX}/bin/
+	${MKDIR} ${PREFIX}/etc/periodic/daily/
+	${INSTALL_SCRIPT} ${WRKDIR}/400.polipo ${PREFIX}/etc/periodic/daily/
+	${INSTALL_MAN} ${WRKSRC}/polipo.man ${PREFIX}/man/man1/polipo.1
+	${MKDIR} ${PCONFIGDIR}
+	${INSTALL_DATA} ${WRKSRC}/config.sample ${PCONFIGDIR}
+	${INSTALL_DATA} ${WRKSRC}/forbidden.sample ${PCONFIGDIR}
+	${CHGRP} -R ${PGRP} ${PCONFIGDIR}
+.if !defined(NO_PTEXINFO)
+	${INSTALL_DATA} ${WRKSRC}/polipo.info ${PREFIX}/info/
+.endif
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/html/* ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/localindex.html ${DATADIR}/www/index.html
+	${CHGRP} -R ${PGRP} ${DATADIR}
+.endif
+
+post-install:
+	@PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ www/polipo/distinfo
@@ -0,0 +1,3 @@
+MD5 (polipo-1.0.4.tar.gz) = defdce7f8002ca68705b6c2c36c4d096
+SHA256 (polipo-1.0.4.tar.gz) = f6458a3ab2548280d4f5596f8d5ae60c61ddf7147ee0b3bb2d67b96da49c0436
+SIZE (polipo-1.0.4.tar.gz) = 180487
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/www/Makefile,v
retrieving revision 1.71
retrieving revision 1.72
diff -L www/Makefile -L www/Makefile -u -r1.71 -r1.72
--- www/Makefile
+++ www/Makefile
@@ -65,6 +65,7 @@
     SUBDIR += php5-session
     SUBDIR += php5-tidy
     SUBDIR += pmwiki
+    SUBDIR += polipo
     SUBDIR += privoxy
     SUBDIR += retsina
     SUBDIR += seamonkey
--- /dev/null
+++ www/polipo/files/pkg-install.in
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+POLIPOUSER=%%USER%%
+POLIPOGROUP=%%GROUP%%
+UID=173
+GID=${UID}
+
+POLIPOCACHE=%%PCACHEDIR%%
+POLIPOLOG=%%PLOGFILE%%
+PPIDDIR=%%PPIDDIR%%
+POLIPOPID=%%PPIDFILE%%
+
+if [ "$2" = "PRE-INSTALL" ]; then
+
+	if [ "%%RC_SUBR%%" = "" ]; then
+		echo "=> Port requires /etc/rc.subr (native or port/sysutils/rc_subr)!"
+		echo "=> If you want to install without you should modify startup script and pkg-install."
+		exit 1
+	fi
+
+	if fgrep "polipo" "%%DESTDIR%%/etc/newsyslog.conf" 2>/dev/null 1>&2; then
+		if ! fgrep "polipo.pid" "%%DESTDIR%%/etc/newsyslog.conf" 2>/dev/null 1>&2; then
+			echo "==> ERROR: Previous installation left an invalid entry in %%DESTDIR%%/etc/newsyslog.conf."
+			echo "==> Please remove the polipo line from this file and try again."
+			exit 1
+		fi
+	fi
+
+	if ! pw groupshow "$POLIPOGROUP" 2>/dev/null 1>&2; then
+		if pw groupadd $POLIPOGROUP -g ${GID} ; then
+			echo "=> Added group \"$POLIPOGROUP\"."
+		else
+			echo "=> Adding group \"$POLIPOGROUP\" failed..."
+			exit 1
+		fi
+	fi
+
+	if ! pw usershow "$POLIPOUSER" 2>/dev/null 1>&2; then
+		if pw useradd $POLIPOUSER -u ${UID} -g $POLIPOGROUP -h - \
+			-s "/sbin/nologin" -d "/nonexistent" \
+			-c "polipo web cache"; \
+		then
+			echo "=> Added user \"$POLIPOUSER\"."
+		else
+			echo "=> Adding user \"$POLIPOUSER\" failed..."
+			exit 1
+		fi
+	fi
+
+elif [ "$2" = "POST-INSTALL" ]; then
+
+	if [ ! -d "%%DESTDIR%%$POLIPOCACHE" ]; then
+		mkdir -p "%%DESTDIR%%$POLIPOCACHE" || exit 1
+		chown "$POLIPOUSER:$POLIPOGROUP" "%%DESTDIR%%$POLIPOCACHE" || exit 1
+		chmod 0770 "%%DESTDIR%%$POLIPOCACHE" || exit 1
+	fi
+
+	if [ ! -d "%%DESTDIR%%$PPIDDIR" ]; then
+		mkdir -p "%%DESTDIR%%$PPIDDIR" || exit 1
+		chgrp "$POLIPOGROUP" "%%DESTDIR%%$PPIDDIR" || exit 1
+		chmod g+w "%%DESTDIR%%$PPIDDIR" || exit 1
+	fi
+
+	if [ ! -f "%%DESTDIR%%$POLIPOLOG" ]; then
+		touch "%%DESTDIR%%$POLIPOLOG" || exit 1
+		chown "$POLIPOUSER" "%%DESTDIR%%$POLIPOLOG" || exit 1
+		chmod 0640 "%%DESTDIR%%$POLIPOLOG" || exit 1
+	fi
+
+
+	if ! fgrep "${POLIPOLOG}" "%%DESTDIR%%/etc/newsyslog.conf" 2>/dev/null 1>&2; then
+	echo "${POLIPOLOG}		${POLIPOUSER}:		640  3     100	*     J     $POLIPOPID 30" >> "%%DESTDIR%%/etc/newsyslog.conf" || exit 1
+	fi
+
+fi
+
+exit 0
--- /dev/null
+++ www/polipo/files/polipo.sh.in
@@ -0,0 +1,44 @@
+#!/bin/sh
+# $MidnightBSD: mports/www/polipo/files/polipo.sh.in,v 1.1 2008/04/13 02:21:49 laffer1 Exp $
+
+# PROVIDE: polipo
+# REQUIRE: NETWORK
+# KEYWORD: shutdown
+
+. %%RC_SUBR%%
+
+name=polipo
+rcvar=`set_rcvar`
+polipo_enable=${polipo_enable:-"NO"}
+polipo_flags=${polipo_flags:-""}
+polipo_user=%%USER%%
+polipo_group=%%GROUP%%
+pidfile=%%PPIDFILE%%
+config_file=%%PCONFIGDIR%%config
+required_files=$config_file
+
+command="%%PREFIX%%/bin/polipo"
+config_args="-c ${config_file}"
+command_args="$config_args daemonise=true pidFile=${pidfile}"
+start_precmd="rm -f ${pidfile}"
+
+extra_commands=expire
+
+expire_cmd=expire_cmd
+expire_cmd () {
+	if [ $rc_pid ]; then
+        	kill -USR1 $rc_pid
+		# allow polipo to write out all files
+		sleep 5
+	fi
+        su -m ${polipo_user} -c "${command} ${config_args} -x"
+	if [ $rc_pid ]; then
+        	kill -USR2 $rc_pid
+	fi
+}
+
+
+load_rc_config $name
+
+run_rc_command "$1"
+
--- /dev/null
+++ www/polipo/files/pkg-message.in
@@ -0,0 +1,14 @@
+To complete the polipo installation you should:
+
+1. copy the configuration file example and modify it if desired
+   cd %%PCONFIGDIR%%
+   cp config.sample config
+   vi config
+   
+2. enable automatic polipo startup with entry in %%DESTDIR%%/etc/rc.conf.local or %%DESTDIR%%/etc/rc.conf
+   polipo_enable="YES"
+   
+3. start polipo
+   %%DESTDIR%%%%PREFIX%%/etc/rc.d/polipo start
+   
+4. point your browser to the new proxy server, the default port is 8123
--- /dev/null
+++ www/polipo/files/pkg-deinstall.in
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+
+if [ "$2" != "POST-DEINSTALL" ]; then
+	exit 0
+fi
+
+POLIPOUSER=%%USER%%
+POLIPOGROUP=%%GROUP%%
+
+PCONFIGDIR=%%PCONFIGDIR%%
+PPIDDIR=%%PPIDDIR%%
+POLIPOCACHE=%%PCACHEDIR%%
+POLIPOLOG=%%PLOGFILE%%
+POLIPOPID=%%PPIDFILE%%
+POLIPODATA=%%DATADIR%%
+
+
+if pw usershow "${POLIPOUSER}" 2>/dev/null 1>&2; then
+	echo "---> To delete ${POLIPOUSER} user permanently, use 'pw userdel \"${POLIPOUSER}\"'"
+fi
+
+if [ -d "$POLIPOCACHE" ]; then
+	rm -r "$POLIPOCACHE" || exit 1
+fi
+if [ -d "$PPIDDIR" ]; then
+	rm -r "$PPIDDIR" || exit 1
+fi
+
+if fgrep "${POLIPOLOG}" "/etc/newsyslog.conf" 2>/dev/null 1>&2; then
+ 	echo "---> You should remove from /etc/newsyslog.conf the \"${POLIPOLOG}\" entry manually."
+fi
+
+rmdir $POLIPODATA/www/doc $POLIPODATA/www $POLIPODATA 2>/dev/null
+rmdir $PCONFIGDIR 2>/dev/null || echo "---> If you not plan to reinstall polipo, you can safely remove ${PCONFIGDIR}."
+exit 0
--- /dev/null
+++ www/polipo/files/400.polipo.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# control file for periodic/daily
+# polipo expiry
+# 
+#
+
+if [ -r %%PREFIX%%/etc/rc.d/polipo ]
+then
+	echo ""
+	echo "polipo expiry:"
+	%%PREFIX%%/etc/rc.d/polipo expire
+fi
+if [ -r %%PREFIX%%/etc/rc.d/polipo.sh ]
+then
+	echo ""
+	echo "polipo expiry:"
+	%%PREFIX%%/etc/rc.d/polipo.sh expire
+fi
+
+exit 0
--- /dev/null
+++ www/polipo/files/patch-aa
@@ -0,0 +1,86 @@
+--- Makefile	Tue Jun 29 02:07:35 2004
++++ Makefile	Mon Dec 27 15:35:40 2004
+@@ -2,8 +2,8 @@
+ BINDIR = $(PREFIX)/bin
+ MANDIR = $(PREFIX)/man
+ INFODIR = $(PREFIX)/info
+-LOCAL_ROOT = /usr/share/polipo/www
+-DISK_CACHE_ROOT = /var/cache/polipo
++LOCAL_ROOT = $(PREFIX)/share/polipo/www
++DISK_CACHE_ROOT ?= /var/cache/polipo
+ 
+ # CDEBUGFLAGS = -O
+ 
+@@ -47,7 +47,8 @@
+ 
+ DEFINES = $(FILE_DEFINES) $(PLATFORM_DEFINES)
+ 
+-CFLAGS = $(MD5INCLUDES) $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES)
++CFLAGS ?= $(CDEBUGFLAGS)
++CFLAGS += $(MD5INCLUDES) $(DEFINES) $(EXTRA_DEFINES)
+ 
+ SRCS = util.c event.c io.c chunk.c atom.c object.c log.c diskcache.c main.c \
+        config.c local.c http.c client.c server.c auth.c tunnel.c \
+--- config.sample	Mon Sep  6 23:31:57 2004
++++ config.sample	Mon Dec 27 15:35:40 2004
+@@ -65,6 +65,11 @@
+ 
+ # localDocumentRoot = ""
+ 
++# Access rights for new cache files.
++diskCacheFilePermissions=0640
++# Access rights for new directories.
++diskCacheDirectoryPermissions=0750
++
+ 
+ ### Domain Name System
+ ### ******************
+--- forbidden.c	Sat Sep 11 00:31:24 2004
++++ forbidden.c	Mon Dec 27 15:35:40 2004
+@@ -158,8 +158,8 @@
+     }
+ 
+     if(forbiddenFile == NULL) {
+-        if(access("/etc/polipo/forbidden", F_OK) >= 0)
+-            forbiddenFile = internAtom("/etc/polipo/forbidden");
++        if(access("/usr/local/etc/polipo/forbidden", F_OK) >= 0)
++            forbiddenFile = internAtom("/usr/local/etc/polipo/forbidden");
+     }
+ 
+     if(have_forbiddenDomains) {
+--- main.c	Tue Oct  5 23:41:49 2004
++++ main.c	Mon Dec 27 15:35:40 2004
+@@ -106,8 +106,8 @@
+     }
+ 
+     if(configFile == NULL) {
+-        if(access("/etc/polipo/config", F_OK) >= 0)
+-            configFile = internAtom("/etc/polipo/config");
++        if(access("/usr/local/etc/polipo/config", F_OK) >= 0)
++            configFile = internAtom("/usr/local/etc/polipo/config");
+         if(configFile && access(configFile->string, F_OK) < 0) {
+             releaseAtom(configFile);
+             configFile = NULL;
+--- polipo.man	Tue Jun 29 02:07:35 2004
++++ polipo.man	Mon Dec 27 15:35:40 2004
+@@ -43,16 +43,16 @@
+ Change the value of a configuration variable.
+ .SH FILES
+ .TP
+-.B /etc/polipo/config
++.B /usr/local/etc/polipo/config
+ The default location of Polipo's configuration file.
+ .TP
+-.B /etc/polipo/forbidden
++.B /usr/local/etc/polipo/forbidden
+ The default location of the list of forbidden URLs.
+ .TP
+ .B /var/cache/polipo/
+ The default location of the on-disk cache.
+ .TP
+-.B /usr/share/polipo/www/
++.B /usr/local/share/polipo/www/
+ The default root of the local web space.
+ .SH SIGNALS
+ .TP 
+


More information about the Midnightbsd-cvs mailing list