aboutsummaryrefslogtreecommitdiff
path: root/contrib/polipo/PolipoPostflight
blob: 0894caec6c48ce7bf261eaf686a67a77524ec7bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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