2007-09-23 03:16:28 +02:00
|
|
|
#!/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
|
2008-10-01 03:55:07 +02:00
|
|
|
TARGET=/Library/Polipo
|
2007-09-23 03:16:28 +02:00
|
|
|
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
|
2007-12-14 06:20:38 +01:00
|
|
|
MAN1=$TARGET/share/man/man1
|
2007-09-23 03:16:28 +02:00
|
|
|
|
|
|
|
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
|