summaryrefslogtreecommitdiff
path: root/contrib/osx/TorPostflight
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-01-05 02:46:25 +0000
committerNick Mathewson <nickm@torproject.org>2005-01-05 02:46:25 +0000
commit20142a2508b6fb486a7df4b61afae4522fd32571 (patch)
treeb0dc496d6fb31ea6f20489a8bf3aba8bb22d40e9 /contrib/osx/TorPostflight
parent041edf87548688b67477b9216268d18501160a4e (diff)
downloadtor-20142a2508b6fb486a7df4b61afae4522fd32571.tar.gz
tor-20142a2508b6fb486a7df4b61afae4522fd32571.zip
Forward-port OSX packaging stuff from maint branch
svn:r3299
Diffstat (limited to 'contrib/osx/TorPostflight')
-rw-r--r--contrib/osx/TorPostflight36
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/osx/TorPostflight b/contrib/osx/TorPostflight
new file mode 100644
index 0000000000..1a46fcd0f1
--- /dev/null
+++ b/contrib/osx/TorPostflight
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# TorPostflight gets invoked after any install or upgrade.
+
+ADDSYSUSER=$RECEIPT_PATH/addsysuser
+if [ ! -x "$ADDSYSUSER" ]; then
+ echo "Could not find addsysuser script."
+ exit 1
+fi
+
+TORUSER=_tor
+TORGROUP=daemon
+TORDIR=/Library/Tor/var/lib/tor
+
+# Create user $TORUSER in group daemon. If it's already there, great.
+$ADDSYSUSER $TORUSER "Tor System user" $TORDIR
+
+# Create the tor directory, if it doesn't exist.
+if [ ! -d $TORDIR ]; then
+ mkdir -p $TORDIR
+fi
+# Check its permissions.
+chown $TORUSER $TORDIR
+chgrp daemon $TORDIR
+chmod 700 $TORDIR
+
+# Ensure a symbolic link.
+cd /usr/bin
+if [ -e /usr/bin/tor -a ! -L /usr/bin/tor ]; then
+ mv tor tor_old
+fi
+if [ -e /usr/bin/tor-resolve -a ! -L /usr/bin/tor-resolve ]; then
+ mv tor-resolve tor-resolve_old
+fi
+ln -sf /Library/Tor/tor .
+ln -sf /Library/Tor/tor_resolve .