3 # TorPostflight gets invoked after any install or upgrade.
5 ADDSYSUSER
=$RECEIPT_PATH/addsysuser
6 if [ ! -x "$ADDSYSUSER" ]; then
7 echo "Could not find addsysuser script."
14 TORDIR
=$TARGET/var
/lib
/tor
15 LOGDIR
=$TARGET/var
/log
/tor
17 # Create user $TORUSER in group daemon. If it's already there, great.
18 $ADDSYSUSER $TORUSER "Tor System user" $TORDIR
20 # Create the tor directory, if it doesn't exist.
21 if [ ! -d $TORDIR ]; then
24 if [ ! -d $LOGDIR ]; then
27 # Check its permissions.
28 chown
$TORUSER $TORDIR
31 chown
$TORUSER $LOGDIR
35 # Create the configuration file only if there wan't one already.
36 if [ ! -f $TARGET/torrc
]; then
37 cp $TARGET/torrc.sample
$TARGET/torrc
40 # Ensure symbolic links
42 if [ -e /usr
/bin
/tor
-a ! -L /usr
/bin
/tor
]; then
45 if [ -e /usr
/bin
/tor-resolve
-a ! -L /usr
/bin
/tor-resolve
]; then
46 mv tor-resolve tor-resolve_old
49 ln -sf $TARGET/tor_resolve .
51 cd /usr
/share
/man
/man1
55 if [ ! -e /var
/log
/tor
-o -L /var
/log
/tor
]; then
61 if [ -d /Library
/StartupItems
/Tor
]; then
62 rm -f /Library
/StartupItems
/Tor
/Tor.loc
63 echo "$TARGET" > /Library
/StartupItems
/Tor
/Tor.loc
66 if [ -d /Library
/StartupItems
/Privoxy
]; then
67 find /Library
/StartupItems
/Privoxy
-print0 |
xargs -0 chown root
:wheel