summaryrefslogtreecommitdiff
path: root/contrib/polipo/PolipoPostflight
diff options
context:
space:
mode:
authorAndrew Lewman <andrew@torproject.org>2007-09-23 01:16:28 +0000
committerAndrew Lewman <andrew@torproject.org>2007-09-23 01:16:28 +0000
commit2aa0cfd5eeeb67953fd861a5f60aeb374b7785a7 (patch)
treea31eaf84f4ba375208d310366e8542a85dbb6835 /contrib/polipo/PolipoPostflight
parent011941853cc7f7211b1d57b0b43b6bbbfb013ad1 (diff)
downloadtor-2aa0cfd5eeeb67953fd861a5f60aeb374b7785a7.tar.gz
tor-2aa0cfd5eeeb67953fd861a5f60aeb374b7785a7.zip
Add my polipo hacks to the tor repo to keep track of them.
svn:r11587
Diffstat (limited to 'contrib/polipo/PolipoPostflight')
-rw-r--r--contrib/polipo/PolipoPostflight56
1 files changed, 56 insertions, 0 deletions
diff --git a/contrib/polipo/PolipoPostflight b/contrib/polipo/PolipoPostflight
new file mode 100644
index 0000000000..4c24c5eb37
--- /dev/null
+++ b/contrib/polipo/PolipoPostflight
@@ -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