#!/bin/sh
# $Id$

. install_var.sh

su - postgres -c "dropdb toughlog"
su - postgres -c "dropuser toughlog"

[ -n "`grep '^toughlog:' /etc/passwd`" ] && userdel -r toughlog
[ -n "`grep '^toughlog:' /etc/group`" ] && groupdel toughlog

rm -f /usr/local/bin/toughlogd
rm -f /usr/local/bin/toughlog2sql

rm -f /etc/toughlog/toughlog.conf
rm -f /etc/toughlog/apache.conf
# gør noget med httpd.conf så den ikke savner ovenstående fil
perl -i -pe "s|^Include /etc/toughlog/apache.conf.*$||" ${APACHECONF}

su - postgres "psql -c \"drop procedural language 'PLpgSQL'\""
su - postgres "psql -c \"drop function plpgsql_call_handler()\""

echo "Wait about 30 seconds before trying to reinstall ToughLog. PostgreSQL has to finish 'dropdb' and release access to 'template1'."

