#!/bin/sh

# PrivoxyConfPostFlight gets invoked after any install or upgrade.

TARGET=$2/Library/Privoxy
LOG='Privoxy-postflight-log.txt'

# If Privoxy was running, kill it before starting a new one
PID=`ps -ax | grep privoxy | grep -v grep | awk '{ print $1 }'`
if [ x$PID != x ]
then
  sudo kill $PID 2>&1 > $TARGET/$LOG
fi

# Start Privoxy, so it's using the new config
$TARGET/StartPrivoxy.command 2>&1 > $TARGET/$LOG

