pkg://postgresql-7.4_7.4.19-0etch1_powerpc.deb:3753004/postrm
info downloads
#!/bin/sh -e
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d postgresql-7.4 remove >/dev/null || exit $?
fi
# End automatically added section
VERSION=7.4
clean_dir() {
if [ -d "$1" -a ! -L "$1" ]; then
rmdir "$1" >/dev/null 2>/dev/null || true
fi
}
drop_cluster() {
# if we still have the postgresql-common package, use it to also shutdown
# server, etc.; otherwise just remove the directories
if [ -x /usr/bin/pg_dropcluster ]; then
pg_dropcluster --stop-server $VERSION "$1"
else
# remove data directory
if DATA=$(readlink -f /etc/postgresql/$VERSION/"$1"/pgdata); then
rm -rf "$DATA" /etc/postgresql/$VERSION/"$1"/pgdata
fi
# remove log file
if LOG=$(readlink -f /etc/postgresql/$VERSION/"$1"/log); then
rm -rf "$LOG" /etc/postgresql/$VERSION/"$1"/log
fi
# remove conffiles
for f in pg_hba.conf pg_ident.conf postgresql.conf; do
rm -f /etc/postgresql/$VERSION/"$1"/$f
done
clean_dir /etc/postgresql/$VERSION/"$1"
fi
}
if [ "$1" = purge ]; then
[ -d "/etc/postgresql/$VERSION" ] || exit 0
if [ "$(ls /etc/postgresql/$VERSION)" ]; then
for c in /etc/postgresql/$VERSION/*; do
[ -e "$c/pgdata" ] || continue
cluster=$(basename "$c")
echo "Dropping cluster $cluster..."
drop_cluster "$cluster"
done
fi
clean_dir /etc/postgresql/$VERSION
clean_dir /etc/postgresql
clean_dir /var/lib/postgresql/$VERSION
clean_dir /var/lib/postgresql
fi