2007-09-23 03:16:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2004-2005 Nick Mathewson & Andrew Lewman.
|
2008-02-13 16:08:45 +01:00
|
|
|
# Copyright 2005-2008 Andrew Lewman
|
|
|
|
# This is licensed under the Modified BSD License.
|
2007-09-23 03:16:28 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
# Helpful info on OS X packaging:
|
|
|
|
# http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/index.html
|
|
|
|
# man packagemaker
|
|
|
|
|
2008-01-11 15:25:49 +01:00
|
|
|
VERSION="1.0.4"
|
2007-09-23 03:16:28 +02:00
|
|
|
|
|
|
|
## 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
|
2010-02-16 05:47:24 +01:00
|
|
|
"10.6") ARCH="i386";;
|
|
|
|
"10.5") ARCH="i386";;
|
|
|
|
"10.4") ARCH="i386";;
|
2008-08-31 23:41:24 +02:00
|
|
|
"10.3") ARCH="ppc";;
|
|
|
|
"10.2") ARCH="ppc";;
|
|
|
|
"10.1") ARCH="ppc";;
|
|
|
|
"10.0") ARCH="ppc";;
|
|
|
|
*) ARCH="unknown";;
|
2007-09-23 03:16:28 +02:00
|
|
|
esac
|
|
|
|
else
|
2008-08-31 23:41:24 +02:00
|
|
|
ARCH="unknown"
|
2007-09-23 03:16:28 +02:00
|
|
|
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
|
2007-12-08 02:39:21 +01:00
|
|
|
mkdir -p $BUILD_DIR/polipo_packageroot/Library/Polipo/
|
2007-09-23 03:16:28 +02:00
|
|
|
cp polipo $BUILD_DIR/polipo_packageroot/polipo
|
2007-10-06 17:32:12 +02:00
|
|
|
cp config.sample $BUILD_DIR/polipo_packageroot/config
|
2007-09-23 03:16:28 +02:00
|
|
|
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
|
|
|
|
|
2010-02-16 05:47:24 +01:00
|
|
|
groff polipo.man -T ps -m man | /usr/bin/pstopdf -i -o $BUILD_DIR/polipo_packageroot/polipo.pdf
|
2007-09-23 03:16:28 +02:00
|
|
|
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
|
|
|
|
|
2010-02-16 05:47:24 +01:00
|
|
|
sudo mv $BUILD_DIR/output "$BUILD_DIR/Polipo-$VERSION-$ARCH"
|
|
|
|
sudo rm -f "Polipo-$VERSION-$ARCH-Bundle.dmg"
|
2007-09-23 03:16:28 +02:00
|
|
|
USER="`whoami`"
|
2008-08-31 23:41:24 +02:00
|
|
|
sudo hdiutil create -format UDZO -srcfolder "$BUILD_DIR/Polipo-$VERSION-$ARCH" "Polipo-$VERSION-$ARCH.dmg"
|
|
|
|
sudo chown "$USER" "Polipo-$VERSION-$ARCH.dmg"
|
2007-09-23 03:16:28 +02:00
|
|
|
|
|
|
|
#sudo rm -rf $BUILD_DIR
|