mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Add my polipo hacks to the tor repo to keep track of them.
svn:r11587
This commit is contained in:
parent
011941853c
commit
2aa0cfd5ee
60
contrib/polipo/Makefile.mingw
Normal file
60
contrib/polipo/Makefile.mingw
Normal file
@ -0,0 +1,60 @@
|
||||
PREFIX = "."
|
||||
BINDIR = $(PREFIX)\
|
||||
LDLIBS = -lwsock32
|
||||
|
||||
FILE_DEFINES = -DLOCAL_ROOT=\".\www\" -DDISK_CACHE_ROOT=\".\cache\"
|
||||
|
||||
# You may optionally also add any of the following to DEFINES:
|
||||
#
|
||||
# -DNO_DISK_CACHE to compile out the on-disk cache and local web server;
|
||||
# -DNO_IPv6 to avoid using the RFC 3493 API and stick to stock
|
||||
# Berkeley sockets;
|
||||
# -DHAVE_IPv6 to force the use of the RFC 3493 API on systems other
|
||||
# than GNU/Linux and BSD (let me know if it works);
|
||||
# -DNO_FANCY_RESOLVER to compile out the asynchronous name resolution
|
||||
# code;
|
||||
# -DNO_STANDARD_RESOLVER to compile out the code that falls back to
|
||||
# gethostbyname/getaddrinfo when DNS requests fail;
|
||||
# -DNO_TUNNEL to compile out the code that handles CONNECT requests;
|
||||
# -DNO_SOCKS to compile out the SOCKS gateway code.
|
||||
# -DNO_FORBIDDEN to compile out the all of the forbidden URL code
|
||||
# -DNO_REDIRECTOR to compile out the Squid-style redirector code
|
||||
|
||||
DEFINES = $(FILE_DEFINES) $(PLATFORM_DEFINES)
|
||||
|
||||
CFLAGS = -O3 -g -Wall $(MD5INCLUDES) $(CDEBUGFLAGS) $(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 \
|
||||
http_parse.c parse_time.c dns.c forbidden.c \
|
||||
md5import.c md5.c ftsimport.c fts_compat.c socks.c mingw.c
|
||||
|
||||
OBJS = util.o event.o io.o chunk.o atom.o object.o log.o diskcache.o main.o \
|
||||
config.o local.o http.o client.o server.o auth.o tunnel.o \
|
||||
http_parse.o parse_time.o dns.o forbidden.o \
|
||||
md5import.o ftsimport.o socks.o mingw.o
|
||||
|
||||
polipo.exe: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o polipo.exe $(OBJS) $(MD5LIBS) -lwsock32
|
||||
|
||||
ftsimport.o: ftsimport.c fts_compat.c
|
||||
|
||||
md5import.o: md5import.c md5.c
|
||||
|
||||
.PHONY: all install install.binary install.man
|
||||
|
||||
all: polipo$(EXE) localindex.html
|
||||
|
||||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm -f polipo.exe *.o *~ core TAGS gmon.out
|
||||
-rm -f polipo.cp polipo.fn polipo.log polipo.vr
|
||||
-rm -f polipo.cps polipo.info* polipo.pg polipo.toc polipo.vrs
|
||||
-rm -f polipo.aux polipo.dvi polipo.ky polipo.ps polipo.tp
|
||||
-rm -f polipo.dvi polipo.ps polipo.ps.gz polipo.pdf polipo.html
|
||||
-rm -rf ./html/
|
||||
-rm -f polipo.man.html
|
99
contrib/polipo/Makefile.osx
Normal file
99
contrib/polipo/Makefile.osx
Normal file
@ -0,0 +1,99 @@
|
||||
PREFIX = /Library/Polipo
|
||||
BINDIR = $(PREFIX)/bin
|
||||
MANDIR = $(PREFIX)/man
|
||||
INFODIR = $(PREFIX)/info
|
||||
LOCAL_ROOT = $(PREFIX)/www
|
||||
DISK_CACHE_ROOT = $(PREFIX)/cache
|
||||
|
||||
CC = gcc
|
||||
# CDEBUGFLAGS = -Os -g -Wall -std=gnu99
|
||||
CDEBUGFLAGS = -Os -g -Wall
|
||||
|
||||
FILE_DEFINES = -DLOCAL_ROOT=\"$(LOCAL_ROOT)/\" \
|
||||
-DDISK_CACHE_ROOT=\"$(DISK_CACHE_ROOT)/\"
|
||||
|
||||
# You may optionally also add any of the following to DEFINES:
|
||||
#
|
||||
# -DNO_DISK_CACHE to compile out the on-disk cache and local web server;
|
||||
# -DNO_IPv6 to avoid using the RFC 3493 API and stick to stock
|
||||
# Berkeley sockets;
|
||||
# -DHAVE_IPv6 to force the use of the RFC 3493 API on systems other
|
||||
# than GNU/Linux and BSD (let me know if it works);
|
||||
# -DNO_FANCY_RESOLVER to compile out the asynchronous name resolution
|
||||
# code;
|
||||
# -DNO_STANDARD_RESOLVER to compile out the code that falls back to
|
||||
# gethostbyname/getaddrinfo when DNS requests fail;
|
||||
# -DNO_TUNNEL to compile out the code that handles CONNECT requests;
|
||||
# -DNO_SOCKS to compile out the SOCKS gateway code.
|
||||
# -DNO_FORBIDDEN to compile out the all of the forbidden URL code
|
||||
# -DNO_REDIRECTOR to compile out the Squid-style redirector code
|
||||
|
||||
DEFINES = $(FILE_DEFINES) $(PLATFORM_DEFINES)
|
||||
|
||||
UNIVERSAL = -O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
|
||||
LDFLAGS = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
|
||||
CFLAGS = $(MD5INCLUDES) $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES) $(UNIVERSAL)
|
||||
|
||||
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 \
|
||||
http_parse.c parse_time.c dns.c forbidden.c \
|
||||
md5import.c md5.c ftsimport.c fts_compat.c socks.c
|
||||
|
||||
OBJS = util.o event.o io.o chunk.o atom.o object.o log.o diskcache.o main.o \
|
||||
config.o local.o http.o client.o server.o auth.o tunnel.o \
|
||||
http_parse.o parse_time.o dns.o forbidden.o \
|
||||
md5import.o ftsimport.o socks.o
|
||||
|
||||
polipo: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o polipo $(OBJS) $(MD5LIBS) $(LDLIBS)
|
||||
|
||||
ftsimport.o: ftsimport.c fts_compat.c
|
||||
|
||||
md5import.o: md5import.c md5.c
|
||||
|
||||
.PHONY: all install install.binary install.man
|
||||
|
||||
all: polipo
|
||||
|
||||
install: install.binary install.man
|
||||
|
||||
install.binary: all
|
||||
mkdir -p $(TARGET)$(BINDIR)
|
||||
mkdir -p $(TARGET)$(LOCAL_ROOT)
|
||||
mkdir -p $(TARGET)$(LOCAL_ROOT)/doc
|
||||
mkdir -p $(TARGET)$(DISK_CACHE_ROOT)
|
||||
cp -f polipo $(TARGET)$(BINDIR)/
|
||||
cp -f localindex.html $(TARGET)$(LOCAL_ROOT)/index.html
|
||||
cp -f config.osx $(TARGET)$(LOCAL_ROOT)/config
|
||||
texi2html polipo.texi && cp -f polipo.html $(TARGET)$(LOCAL_ROOT)/doc/index.html
|
||||
groff polipo.man -T ps -m man | pstopdf -i -o $(TARGET)/polipo.pdf
|
||||
mkdir -p /Library/StartupItems/Polipo
|
||||
cp -f contrib/Polipo /Library/StartupItems/Polipo/
|
||||
cp -f contrib/StartupParameters.plist /Library/StartupItems/Polipo/
|
||||
echo "POLIPO=-YES-" >> /etc/hostconfig
|
||||
|
||||
install.man: all
|
||||
mkdir -p $(TARGET)$(MANDIR)/man1
|
||||
cp -f polipo.man $(TARGET)$(MANDIR)/man1/polipo.1
|
||||
|
||||
TAGS: $(SRCS)
|
||||
etags $(SRCS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm -f polipo *.o *~ core TAGS gmon.out
|
||||
-rm -f polipo.cp polipo.fn polipo.log polipo.vr
|
||||
-rm -f polipo.cps polipo.info* polipo.pg polipo.toc polipo.vrs
|
||||
-rm -f polipo.aux polipo.dvi polipo.ky polipo.ps polipo.tp
|
||||
-rm -f polipo.dvi polipo.ps polipo.ps.gz polipo.pdf polipo.html
|
||||
-rm -rf ./html/
|
||||
-rm -f polipo.man.html
|
||||
|
||||
.PHONY: uninstall
|
||||
|
||||
uninstall:
|
||||
rm -rf /Library/Polipo
|
||||
rm -rf /Library/StartupItems/Polipo
|
||||
cp -f /etc/hostconfig /etc/hostconfig.polipo.saved
|
||||
cat /etc/hostconfig.polipo.saved | grep -v POLIPO > /etc/hostconfig
|
40
contrib/polipo/Polipo
Normal file
40
contrib/polipo/Polipo
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
##
|
||||
# Polipo
|
||||
##
|
||||
|
||||
. /etc/rc.common
|
||||
|
||||
StartService ()
|
||||
{
|
||||
if [ -f /Library/Polipo/bin/polipo ]; then
|
||||
if pid=$(GetPID polipo); then
|
||||
return 0
|
||||
else if [ "${POLIPO:=-NO-}" = "-YES-" ]; then
|
||||
ConsoleMessage "Starting Polipo"
|
||||
/Library/Polipo/bin/polipo -c /Library/Polipo/www/config
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
StopService ()
|
||||
{
|
||||
if pid=$(GetPID polipo); then
|
||||
ConsoleMessage "Stopping Polipo"
|
||||
kill -TERM "${pid}"
|
||||
else
|
||||
ConsoleMessage "Polipo not responding."
|
||||
# Just for sanity (sometimes necessary.)
|
||||
killall tor 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
RestartService ()
|
||||
{
|
||||
StopService
|
||||
StartService
|
||||
}
|
||||
|
||||
RunService "$1"
|
10
contrib/polipo/PolipoDesc.plist
Normal file
10
contrib/polipo/PolipoDesc.plist
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IFPkgDescriptionTitle</key>
|
||||
<string>Polipo</string>
|
||||
<key>IFPkgDescriptionVersion</key>
|
||||
<string>20061218</string>
|
||||
</dict>
|
||||
</plist>
|
28
contrib/polipo/PolipoInfo.plist
Normal file
28
contrib/polipo/PolipoInfo.plist
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>Polipo 20061218</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Polipo 20061218</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Polipo</string>
|
||||
<key>CFBundleSortVersionString</key>
|
||||
<string>20061218</string>
|
||||
<key>IFPkgFlagAllowBackRev</key>
|
||||
<true/>
|
||||
<key>IFPkgFlagAuthorizationAction</key>
|
||||
<string>RootAuthorization</string>
|
||||
<key>IFPkgFlagFollowLinks</key>
|
||||
<true/>
|
||||
<key>IFPkgFlagIsRequired</key>
|
||||
<true/>
|
||||
<key>IFPkgFlagRootVolumeOnly</key>
|
||||
<true/>
|
||||
<key>IfPkgFlagBackgroundScaling</key>
|
||||
<string>proportional</string>
|
||||
<key>IFPkgFlagBackgroundAlignment</key>
|
||||
<string>bottomleft</string>
|
||||
</dict>
|
||||
</plist>
|
56
contrib/polipo/PolipoPostflight
Normal file
56
contrib/polipo/PolipoPostflight
Normal file
@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PolipoPostflight gets invoked after any install or upgrade.
|
||||
|
||||
ADDSYSUSER=$RECEIPT_PATH/addsysuser
|
||||
if [ ! -x "$ADDSYSUSER" ]; then
|
||||
echo "Could not find addsysuser script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
POLIPOUSER=_polipo
|
||||
POLIPOGROUP=daemon
|
||||
TARGET=$2/Library/Polipo
|
||||
LOGDIR=$TARGET/log
|
||||
|
||||
# Check defaults for TARGET
|
||||
if [ "$TARGET" == "//Library/Polipo" ]; then
|
||||
TARGET=/Library/Polipo
|
||||
fi
|
||||
|
||||
# Create user $POLIPOUSER in group daemon. If it's already there, great.
|
||||
$ADDSYSUSER $POLIPOUSER "Polipo System user" $POLIPODIR
|
||||
|
||||
# Create the polipo direcpolipoy, if it doesn't exist.
|
||||
if [ ! -d $POLIPODIR ]; then
|
||||
mkdir -p $POLIPODIR
|
||||
fi
|
||||
if [ ! -d $LOGDIR ]; then
|
||||
mkdir -p $LOGDIR
|
||||
fi
|
||||
# Check its permissions.
|
||||
chown $POLIPOUSER $POLIPODIR
|
||||
chgrp daemon $POLIPODIR
|
||||
chmod 700 $POLIPODIR
|
||||
chown $POLIPOUSER $LOGDIR
|
||||
chgrp daemon $LOGDIR
|
||||
chmod 700 $LOGDIR
|
||||
|
||||
# Create the configuration file only if there wasn't one already.
|
||||
if [ ! -f $TARGET/config]; then
|
||||
cp $TARGET/config.osx $TARGET/config
|
||||
fi
|
||||
|
||||
cd /usr/share/man/man1
|
||||
MAN1=$TARGET/man/man1
|
||||
ln -sf $MAN1/*.1 .
|
||||
|
||||
if [ -d /Library/StartupItems/Polipo ]; then
|
||||
find /Library/StartupItems/Polipo -print0 | xargs -0 chown root:wheel
|
||||
fi
|
||||
|
||||
# Copy Uninstaller
|
||||
if [ -f $PACKAGE_PATH/Contents/Resources/uninstall_polipo_bundle.sh ]; then
|
||||
cp $PACKAGE_PATH/Contents/Resources/uninstall_polipo_bundle.sh $TARGET/uninstall_polipo_bundle.sh
|
||||
chmod 755 $TARGET/uninstall_polipo_bundle.sh
|
||||
fi
|
11
contrib/polipo/StartupParameters.plist
Normal file
11
contrib/polipo/StartupParameters.plist
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
Description = "Polipo";
|
||||
Provides = ("Polipo");
|
||||
Requires = ("NetworkExtensions","Resolver");
|
||||
OrderPreference = "Late";
|
||||
Messages =
|
||||
{
|
||||
start = "Starting Polipo";
|
||||
stop = "Stopping Polipo";
|
||||
};
|
||||
}
|
45
contrib/polipo/addsysuser
Normal file
45
contrib/polipo/addsysuser
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Original adduser 05 Feb 2002 by Jon L. Gardner
|
||||
#
|
||||
# Modified for Tor installer by Nick Mathewson
|
||||
|
||||
ROOTPROP=/
|
||||
|
||||
if [ "`whoami`" != "root" ]; then
|
||||
echo "You must be root to execute this script."
|
||||
exit
|
||||
fi
|
||||
if [ "x$3" = "x" ]; then
|
||||
echo 'Usage: addsysuser <username> "<full name>" <homedir>'
|
||||
exit 0
|
||||
fi
|
||||
username=$1
|
||||
realname=$2
|
||||
homedir=$3
|
||||
# GID 20 is "staff" which is the default. Change it if you want.
|
||||
gid=`niutil -readprop $ROOTPROP /groups/daemon gid`
|
||||
if [ "x`niutil -list $ROOTPROP /users|cut -f2 -d' '|grep $username`" != "x" ]; then
|
||||
echo The account $username already exists.
|
||||
exit 0
|
||||
fi
|
||||
# home is the local path to the home directory
|
||||
home=/Users/$username
|
||||
# defhome is what goes into NetInfo
|
||||
defhome="/Network/Servers/MyServer/Users"
|
||||
#echo "Determining next available system uid (please be patient)..."
|
||||
# Uids over 500 are for system users.
|
||||
uiddef=`nidump passwd / | cut -d: -f3 | sort -n | grep -v '^[56789]..' |grep -v '^....$' | tail -n 1`
|
||||
uiddef=`echo $uiddef + 1 |bc`
|
||||
echo Creating account for $username...
|
||||
niutil -create $ROOTPROP /users/$username
|
||||
niutil -createprop $ROOTPROP /users/$username _writers_tim_passwd $username
|
||||
niutil -createprop $ROOTPROP /users/$username realname $realname
|
||||
niutil -createprop $ROOTPROP /users/$username _writers_passwd $username
|
||||
niutil -createprop $ROOTPROP /users/$username uid $uiddef
|
||||
#niutil -createprop $ROOTPROP /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>"
|
||||
niutil -createprop $ROOTPROP /users/$username gid $gid
|
||||
niutil -createprop $ROOTPROP /users/$username home $homedir
|
||||
niutil -createprop $ROOTPROP /users/$username name $username
|
||||
niutil -createprop $ROOTPROP /users/$username passwd '*'
|
||||
niutil -createprop $ROOTPROP /users/$username shell /dev/null
|
85
contrib/polipo/package.sh
Normal file
85
contrib/polipo/package.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
# $Id: package.sh 8992 2006-12-23 03:12:09Z phobos $
|
||||
# Copyright 2004-2005 Nick Mathewson & Andrew Lewman.
|
||||
# See LICENSE in Polipo distribution for licensing information.
|
||||
|
||||
###
|
||||
# Helpful info on OS X packaging:
|
||||
# http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/index.html
|
||||
# man packagemaker
|
||||
|
||||
VERSION="1.0.2"
|
||||
|
||||
## Determine OSX Version
|
||||
# map version to name
|
||||
if [ -x /usr/bin/sw_vers ]; then
|
||||
# This is poor, yet functional. We don't care about the 3rd number in
|
||||
# the OS version
|
||||
OSVER=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 | cut -d"." -f1,2`
|
||||
case "$OSVER" in
|
||||
"10.5") OS="leopard" ARCH="universal";;
|
||||
"10.4") OS="tiger" ARCH="universal";;
|
||||
"10.3") OS="panther" ARCH="ppc";;
|
||||
"10.2") OS="jaguar" ARCH="ppc";;
|
||||
"10.1") OS="puma" ARCH="ppc";;
|
||||
"10.0") OS="cheetah" ARCH="ppc";;
|
||||
*) OS="unknown";;
|
||||
esac
|
||||
else
|
||||
OS="unknown"
|
||||
fi
|
||||
|
||||
# Where will we put our temporary files?
|
||||
BUILD_DIR=/tmp/polipo-osx-$$
|
||||
# Path to PackageMaker app.
|
||||
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
|
||||
|
||||
umask 022
|
||||
|
||||
echo I might ask you for your password now, so you can sudo.
|
||||
|
||||
sudo rm -rf $BUILD_DIR
|
||||
mkdir $BUILD_DIR || exit 1
|
||||
for subdir in polipo_packageroot output; do
|
||||
mkdir $BUILD_DIR/$subdir
|
||||
done
|
||||
|
||||
### Make Polipo package.
|
||||
chmod 755 contrib/PolipoPostflight
|
||||
cp polipo $BUILD_DIR/polipo_packageroot/polipo
|
||||
cp config.osx $BUILD_DIR/polipo_packageroot/config
|
||||
cp contrib/PolipoPostflight $BUILD_DIR/polipo_packageroot/postflight
|
||||
cp contrib/addsysuser $BUILD_DIR/polipo_packageroot/addsysuser
|
||||
cp contrib/uninstall_polipo_bundle.sh $BUILD_DIR/polipo_packageroot/uninstall_polipo_bundle.sh
|
||||
cp localindex.html $BUILD_DIR/polipo_packageroot/index.html
|
||||
cat <<EOF > $BUILD_DIR/polipo_packageroot/Welcome.txt
|
||||
Polipo: a caching web proxy
|
||||
|
||||
Polipo is a small and fast caching web proxy (a web cache, an HTTP
|
||||
proxy, a proxy server).
|
||||
EOF
|
||||
|
||||
### Assemble documentation
|
||||
|
||||
groff polipo.man -T ps -m man | pstopdf -i -o $BUILD_DIR/polipo_packageroot/polipo.pdf
|
||||
texi2html polipo.texi && cp polipo.html $BUILD_DIR/polipo_packageroot/polipo.html
|
||||
|
||||
find $BUILD_DIR/polipo_packageroot -print0 |sudo xargs -0 chown root:wheel
|
||||
|
||||
$PACKAGEMAKER -build \
|
||||
-p $BUILD_DIR/output/Polipo.pkg \
|
||||
-f $BUILD_DIR/polipo_packageroot \
|
||||
-i contrib/PolipoInfo.plist \
|
||||
-d contrib/PolipoDesc.plist
|
||||
|
||||
### Package it all into a DMG
|
||||
|
||||
find $BUILD_DIR/output -print0 | sudo xargs -0 chown root:wheel
|
||||
|
||||
mv $BUILD_DIR/output "$BUILD_DIR/Polipo-$VERSION-$OS-$ARCH"
|
||||
rm -f "Polipo-$VERSION-$OS-$ARCH-Bundle.dmg"
|
||||
USER="`whoami`"
|
||||
sudo hdiutil create -format UDZO -srcfolder "$BUILD_DIR/Polipo-$VERSION-$OS-$ARCH" "Polipo-$VERSION-$OS-$ARCH.dmg"
|
||||
sudo chown "$USER" "Polipo-$VERSION-$OS-$ARCH.dmg"
|
||||
|
||||
#sudo rm -rf $BUILD_DIR
|
159
contrib/polipo/polipo-mingw.nsi
Normal file
159
contrib/polipo/polipo-mingw.nsi
Normal file
@ -0,0 +1,159 @@
|
||||
;polipo-mingw.nsi - A basic win32 installer for Polipo
|
||||
; Originally written by J Doe.
|
||||
; Modified by Andrew Lewman
|
||||
; See LICENSE for licencing information
|
||||
;-----------------------------------------
|
||||
;
|
||||
!include "MUI.nsh"
|
||||
|
||||
!define VERSION "1.0.2"
|
||||
!define INSTALLER "polipo-${VERSION}-win32.exe"
|
||||
!define WEBSITE "http://www.pps.jussieu.fr/~jch/software/polipo/"
|
||||
|
||||
!define LICENSE "COPYING"
|
||||
;BIN is where it expects to find polipo.exe
|
||||
!define BIN "."
|
||||
|
||||
SetCompressor lzma
|
||||
OutFile ${INSTALLER}
|
||||
InstallDir $PROGRAMFILES\Polipo
|
||||
SetOverWrite ifnewer
|
||||
|
||||
Name "Polipo"
|
||||
Caption "Polipo ${VERSION} Setup"
|
||||
BrandingText "A Caching Web Proxy"
|
||||
CRCCheck on
|
||||
XPStyle on
|
||||
VIProductVersion "${VERSION}"
|
||||
VIAddVersionKey "ProductName" "Polipo: A caching web proxy"
|
||||
VIAddVersionKey "Comments" "http://www.pps.jussieu.fr/~jch/software/polipo/"
|
||||
VIAddVersionKey "LegalTrademarks" "See COPYING"
|
||||
VIAddVersionKey "LegalCopyright" "©2007, Juliusz Chroboczek"
|
||||
VIAddVersionKey "FileDescription" "Polipo is a caching web proxy."
|
||||
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||
|
||||
!define MUI_WELCOMEPAGE_TITLE "Welcome to the Polipo ${VERSION} Setup Wizard"
|
||||
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Polipo ${VERSION}.\r\n\r\nIf you have previously installed Polipo and it is currently running, please exit Polipo first before continuing this installation.\r\n\r\n$_CLICK"
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
|
||||
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\polipo.exe -c $configdir\config"
|
||||
!define MUI_FINISHPAGE_LINK "Visit the Polipo website for the latest updates."
|
||||
!define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
; There's no point in having a clickthrough license: Our license adds
|
||||
; certain rights, but doesn't remove them.
|
||||
; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Var configdir
|
||||
Var configfile
|
||||
|
||||
;Sections
|
||||
;--------
|
||||
|
||||
Section "Polipo" Polipo
|
||||
;Files that have to be installed for polipo to run and that the user
|
||||
;cannot choose not to install
|
||||
SectionIn RO
|
||||
SetOutPath $INSTDIR
|
||||
File "${BIN}\polipo.exe"
|
||||
File "${BIN}\COPYING"
|
||||
File "${BIN}\CHANGES"
|
||||
File "${BIN}\config.windows"
|
||||
File "${BIN}\forbidden.sample"
|
||||
File "${BIN}\README.Windows"
|
||||
WriteIniStr "$INSTDIR\Polipo Website.url" "InternetShortcut" "URL" ${WEBSITE}
|
||||
|
||||
StrCpy $configfile "config"
|
||||
StrCpy $configdir $INSTDIR
|
||||
SetOutPath $configdir
|
||||
;If there's already a polipo config file, ask if they want to
|
||||
;overwrite it with the new one.
|
||||
IfFileExists "$configdir\config" "" endifconfig
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO "You already have a Polipo config file.$\r$\nDo you want to overwrite it with the default sample config file?" IDNO yesreplace
|
||||
Delete $configdir\config
|
||||
Goto endifconfig
|
||||
yesreplace:
|
||||
StrCpy $configfile ".\config.windows"
|
||||
endifconfig:
|
||||
File /oname=$configfile ".\config.windows"
|
||||
IfFileExists "$INSTDIR\www\*.*" "" endifwebroot
|
||||
CreateDirectory "$INSTDIR\www"
|
||||
endifwebroot:
|
||||
CopyFiles "${BIN}\localindex.html" $INSTDIR\www\index.html
|
||||
IfFileExists "$INSTDIR\cache\*.*" "" endifcache
|
||||
CreateDirectory "$INSTDIR\cache"
|
||||
endifcache:
|
||||
SectionEnd
|
||||
|
||||
SubSection /e "Shortcuts" Shortcuts
|
||||
|
||||
Section "Start Menu" StartMenu
|
||||
SetOutPath $INSTDIR
|
||||
IfFileExists "$SMPROGRAMS\Polipo\*.*" "" +2
|
||||
RMDir /r "$SMPROGRAMS\Polipo"
|
||||
CreateDirectory "$SMPROGRAMS\Polipo"
|
||||
CreateShortCut "$SMPROGRAMS\Polipo\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config"
|
||||
CreateShortCut "$SMPROGRAMS\Polipo\Poliporc.lnk" "Notepad.exe" "$configdir\config"
|
||||
CreateShortCut "$SMPROGRAMS\Polipo\Polipo Documentation.lnk" "$INSTDIR\www\index.html"
|
||||
CreateShortCut "$SMPROGRAMS\Polipo\Polipo Website.lnk" "$INSTDIR\Polipo Website.url"
|
||||
CreateShortCut "$SMPROGRAMS\Polipo\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "Desktop" Desktop
|
||||
SetOutPath $INSTDIR
|
||||
CreateShortCut "$DESKTOP\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config"
|
||||
SectionEnd
|
||||
|
||||
Section /o "Run at startup" Startup
|
||||
SetOutPath $INSTDIR
|
||||
CreateShortCut "$SMSTARTUP\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config" "" "" "" SW_SHOWMINIMIZED
|
||||
SectionEnd
|
||||
|
||||
SubSectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
Delete "$DESKTOP\Polipo.lnk"
|
||||
Delete "$INSTDIR\polipo.exe"
|
||||
Delete "$INSTDIR\Polipo Website.url"
|
||||
Delete "$INSTDIR\config"
|
||||
Delete "$INSTDIR\config.sample"
|
||||
StrCmp $configdir $INSTDIR +2 ""
|
||||
RMDir /r $configdir
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
RMDir /r "$INSTDIR\Documents"
|
||||
RMDir $INSTDIR
|
||||
RMDir /r "$SMPROGRAMS\Polipo"
|
||||
RMDir /r "$APPDATA\Polipo"
|
||||
Delete "$SMSTARTUP\Polipo.lnk"
|
||||
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Polipo"
|
||||
SectionEnd
|
||||
|
||||
Section -End
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
;The registry entries simply add the Polipo uninstaller to the Windows
|
||||
;uninstall list.
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "DisplayName" "Polipo (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
SectionEnd
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Polipo} "The core executable and config files needed for Polipo to run."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Polipo"
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Polipo and it's documentation from the Start Menu"
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Polipo from the desktop"
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Polipo automatically at startup in a minimized window"
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
97
contrib/polipo/uninstall_polipo_bundle.sh
Normal file
97
contrib/polipo/uninstall_polipo_bundle.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
|
||||
### this is the location of a file which contains all the actual package names
|
||||
## (ie "Polipo", "polipostartup", ...) the list should be new-line-delimited.
|
||||
PACKAGE_LIST_SRC="Polipo polipostartup"
|
||||
|
||||
### this is the name of the user created in the install process of Polipo
|
||||
POLIPO_USER=_polipo
|
||||
|
||||
### these should be constant across all osX installs (so leave them be)
|
||||
STARTUP_ITEMS_DIR=/Library/StartupItems
|
||||
PKG_RCPT_BASE_DIR=/Library/Receipts
|
||||
BOM_INTERMEDIATE_DIR=Contents/Resources
|
||||
INFO_INTERMEDIATE_DIR=$BOM_INTERMEDIATE_DIR/English.lproj
|
||||
TEMP_BOM_CONTENTS=/tmp/polipo_uninst_scratch
|
||||
|
||||
|
||||
### make sure the script is being run as root, barf if not
|
||||
if [ "`whoami`" != "root" ]; then
|
||||
echo "Must be root to run the uninstall script."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
### check to see if polipo is currently running, kill it if it is
|
||||
## we grep on 'Polipo/polipo ' because 'polipo' is too common (like in 'direcpolipoy')
|
||||
## -- this relies on the fact that polipo has been started with command
|
||||
## line arguments.. :-/
|
||||
POLIPO_PID=`ps -uax | grep 'Polipo/polipo ' | grep -v grep | awk '{print $2;}'`
|
||||
if [ ${#POLIPO_PID} -gt 0 ]; then
|
||||
echo ". Killing currently running polipo process, pid is $POLIPO_PID"
|
||||
kill -9 $POLIPO_PID
|
||||
else
|
||||
echo ". polipo process appears to already be stopped"
|
||||
fi
|
||||
|
||||
|
||||
## grab each package name from the package list file
|
||||
while read LINE; do
|
||||
if [ ${#LINE} -gt 0 ]; then
|
||||
PACKAGE_NAME=$LINE.pkg
|
||||
PACKAGE_PATH=$PKG_RCPT_BASE_DIR/$PACKAGE_NAME
|
||||
echo ". Uninstalling $PACKAGE_NAME"
|
||||
if [ ! -d $PACKAGE_PATH ]; then
|
||||
echo " . No receipt exists for this package -- skipping."
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
## get rid of the startup item if it exists
|
||||
STARTUP_DIR=$STARTUP_ITEMS_DIR/$LINE
|
||||
if [ -d $STARTUP_DIR ]; then
|
||||
echo " . Deleting startup item $STARTUP_DIR"
|
||||
rm -rf $STARTUP_DIR
|
||||
fi
|
||||
|
||||
|
||||
## determine the root direcpolipoy of the the relative paths specified in the bom
|
||||
DEFAULT_LOC=`grep DefaultLocation $PACKAGE_PATH/$INFO_INTERMEDIATE_DIR/$LINE.info | awk '{print $2;}'`
|
||||
if [ ${#DEFAULT_LOC} -eq 0 ]; then
|
||||
echo "!! Could not find default location for $LINE package -- skipping package."
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
## examine the list of installed items desribed in the bom
|
||||
BOM_FILE=$PACKAGE_PATH/$BOM_INTERMEDIATE_DIR/$LINE.bom
|
||||
lsbom $BOM_FILE > $TEMP_BOM_CONTENTS
|
||||
while read BOM_ITEM; do
|
||||
## 3 column items describe just direcpolipoies, 5 column items describe actual files
|
||||
COL_COUNT=$(echo $BOM_ITEM | awk '{print NF;}')
|
||||
if [ "$COL_COUNT" -eq 5 ]; then
|
||||
FILE_NAME=$DEFAULT_LOC/$(echo $BOM_ITEM | awk '{print $1;}')
|
||||
|
||||
echo " . Removing $FILE_NAME"
|
||||
rm -rf $FILE_NAME
|
||||
fi
|
||||
done < $TEMP_BOM_CONTENTS
|
||||
|
||||
## remove package receipt
|
||||
echo " . Removing package receipt $PACKAGE_PATH"
|
||||
rm -rf $PACKAGE_PATH
|
||||
fi
|
||||
done < $PACKAGE_LIST_SRC
|
||||
|
||||
## nuke the user created by the install process.
|
||||
echo ". Removing created user $POLIPO_USER"
|
||||
niutil -destroy . /users/$POLIPO_USER
|
||||
|
||||
## clean up
|
||||
echo ". Cleaning up"
|
||||
rm -rf $TEMP_BOM_CONTENTS
|
||||
rm -rf /Library/Polipo/ /Library/StartupItems/Polipo/
|
||||
echo ". Finished"
|
||||
|
Loading…
Reference in New Issue
Block a user