tor/contrib/polipo/PolipoPostflight
2008-10-01 01:55:07 +00:00

51 lines
1.3 KiB
Bash

#!/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=/Library/Polipo
LOGDIR=$TARGET/log
# 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/share/man/man1
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