1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-21 20:38:45 +00:00

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.

PR:		ports/75554
Submitted by:	Frank Behrens <frank@pinky.sax.de>
This commit is contained in:
Pav Lucistnik 2005-02-05 20:57:43 +00:00
parent 3140f9919a
commit 4492f0b3af
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=128095
11 changed files with 384 additions and 0 deletions

View File

@ -602,6 +602,7 @@
SUBDIR += plugger
SUBDIR += plugger-plugins-hubbe
SUBDIR += pnews
SUBDIR += polipo
SUBDIR += postnuke
SUBDIR += pound
SUBDIR += preferential

88
www/polipo/Makefile Normal file
View File

@ -0,0 +1,88 @@
# New ports collection makefile for: polipo
# Date created: 2005-01-25
# Whom: Frank Behrens <frank@pinky.sax.de>
#
# $FreeBSD$
#
PORTNAME= polipo
PORTVERSION= 0.9.8
CATEGORIES= www
MASTER_SITES= http://www.pps.jussieu.fr/~jch/software/files/polipo/ \
http://www.sax.de/~frank/polipo4bsd/files/
MAINTAINER= frank@pinky.sax.de
COMMENT= A small and fast caching web proxy
MAN1= polipo.1
USE_RC_SUBR= yes
.include <bsd.port.pre.mk>
# in some 4.x makeinfo does not work. So we do not try to build and install.
.if ${OSVERSION} < 500000
NO_PTEXINFO= yes
.endif
.if defined(NO_PTEXINFO)
ALL_TARGET= polipo
NOPORTDOCS= yes
.else
INFO= polipo
.endif
.if !defined(NOPORTDOCS)
DOCSDIR= ${DATADIR}/www/doc
PORTDOCS= *
PLIST_FILES+= share/polipo/www/index.html
.endif
# created on the fly due to variable substitution
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
PKGMESSAGE= ${WRKDIR}/pkg-message
SUB_FILES= pkg-message pkg-install pkg-deinstall 400.polipo polipo.sh
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 ${DESTDIR}${PREFIX}/bin/
${INSTALL_SCRIPT} ${WRKDIR}/polipo.sh ${DESTDIR}${PREFIX}/etc/rc.d/
${MKDIR} ${DESTDIR}${PREFIX}/etc/periodic/daily/
${INSTALL_SCRIPT} ${WRKDIR}/400.polipo ${DESTDIR}${PREFIX}/etc/periodic/daily/
${INSTALL_MAN} ${WRKSRC}/polipo.man ${DESTDIR}${PREFIX}/man/man1/polipo.1
${MKDIR} ${DESTDIR}${PCONFIGDIR}
${INSTALL_DATA} ${WRKSRC}/config.sample ${DESTDIR}${PCONFIGDIR}
${INSTALL_DATA} ${WRKSRC}/forbidden.sample ${DESTDIR}${PCONFIGDIR}
${CHGRP} -R ${PGRP} ${DESTDIR}${PCONFIGDIR}
.if !defined(NO_PTEXINFO)
${INSTALL_DATA} ${WRKSRC}/polipo.info ${DESTDIR}${PREFIX}/info/
install-info ${PREFIX}/info/polipo.info ${DESTDIR}${PREFIX}/info/dir
.endif
.if !defined(NOPORTDOCS)
${MKDIR} ${DESTDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/html/* ${DESTDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/localindex.html ${DESTDIR}${DATADIR}/www/index.html
${CHGRP} -R ${PGRP} ${DESTDIR}${DATADIR}
.endif
post-install:
@PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

2
www/polipo/distinfo Normal file
View File

@ -0,0 +1,2 @@
MD5 (polipo-0.9.8.tar.gz) = 1a2c7bd7710197daee1c26ce5175edbf
SIZE (polipo-0.9.8.tar.gz) = 148275

View File

@ -0,0 +1,15 @@
#!/bin/sh
#
# control file for periodic/daily
# polipo expiry
#
#
if [ -r %%DESTDIR%%%%PREFIX%%/etc/rc.d/polipo.sh ]
then
echo ""
echo "polipo expiry:"
%%DESTDIR%%%%PREFIX%%/etc/rc.d/polipo.sh expire
fi
exit 0

85
www/polipo/files/patch-aa Normal file
View File

@ -0,0 +1,85 @@
--- 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

View File

@ -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

View File

@ -0,0 +1,78 @@
#!/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
pw groupmod mail -m $POLIPOUSER
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

View File

@ -0,0 +1,18 @@
******************************************************************************
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
******************************************************************************

View File

@ -0,0 +1,44 @@
#!/bin/sh
#
# PROVIDE: polipo
# REQUIRE: NETWORK
# BEFORE: NETWORK
# KEYWORD: FreeBSD
. %%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}"
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"

10
www/polipo/pkg-descr Normal file
View File

@ -0,0 +1,10 @@
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@pps.jussieu.fr>
BSD port: http://www.sax.de/~frank/polipo4bsd/
--
Frank Behrens
frank@pinky.sax.de

7
www/polipo/pkg-plist Normal file
View File

@ -0,0 +1,7 @@
bin/polipo
etc/polipo/config.sample
etc/polipo/forbidden.sample
etc/rc.d/polipo.sh
etc/periodic/daily/400.polipo
@unexec rmdir %D/etc/periodic/daily 2>/dev/null || true
@unexec rmdir %D/etc/periodic 2>/dev/null || true