post_install() {
  groupadd -g 42 privoxy &>/dev/null
  useradd -u 42 -g privoxy -d /var/spool/privoxy -s /bin/false privoxy &>/dev/null
  chown -R privoxy:privoxy /etc/privoxy /var/log/privoxy

  if [ ! -d /var/spool/privoxy ]; then
    install -dm0770 -o privoxy -g privoxy /var/spool/privoxy
  fi
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  userdel privoxy &>/dev/null
  groupdel privoxy &>/dev/null
  rm -rf var/spool/privoxy
}
