PolipoPostflight 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # PolipoPostflight gets invoked after any install or upgrade.
  3. ADDSYSUSER=$RECEIPT_PATH/addsysuser
  4. if [ ! -x "$ADDSYSUSER" ]; then
  5. echo "Could not find addsysuser script."
  6. exit 1
  7. fi
  8. POLIPOUSER=_polipo
  9. POLIPOGROUP=daemon
  10. TARGET=/Library/Polipo
  11. LOGDIR=$TARGET/log
  12. # Create user $POLIPOUSER in group daemon. If it's already there, great.
  13. $ADDSYSUSER $POLIPOUSER "Polipo System user" $POLIPODIR
  14. # Create the polipo direcpolipoy, if it doesn't exist.
  15. if [ ! -d $POLIPODIR ]; then
  16. mkdir -p $POLIPODIR
  17. fi
  18. if [ ! -d $LOGDIR ]; then
  19. mkdir -p $LOGDIR
  20. fi
  21. # Check its permissions.
  22. chown $POLIPOUSER $POLIPODIR
  23. chgrp daemon $POLIPODIR
  24. chmod 700 $POLIPODIR
  25. chown $POLIPOUSER $LOGDIR
  26. chgrp daemon $LOGDIR
  27. chmod 700 $LOGDIR
  28. # Create the configuration file only if there wasn't one already.
  29. if [ ! -f $TARGET/config]; then
  30. cp $TARGET/config.osx $TARGET/config
  31. fi
  32. cd /usr/share/man/man1
  33. MAN1=$TARGET/share/man/man1
  34. if [ -d /Library/StartupItems/Polipo ]; then
  35. find /Library/StartupItems/Polipo -print0 | xargs -0 chown root:wheel
  36. fi
  37. # Copy Uninstaller
  38. if [ -f $PACKAGE_PATH/Contents/Resources/uninstall_polipo_bundle.sh ]; then
  39. cp $PACKAGE_PATH/Contents/Resources/uninstall_polipo_bundle.sh $TARGET/uninstall_polipo_bundle.sh
  40. chmod 755 $TARGET/uninstall_polipo_bundle.sh
  41. fi