#! /bin/sh # prerm script for gforge # # see: dh_installdeb(1) # Support for new place for pg_hba.conf # I only try to upgrade on the default cluster if [ -x /usr/bin/pg_lsclusters ] then # We are with new postgresql working with clusters # This is probably not te most elegant way to deal with database # I install or upgrade on the default cluster if it is online # or I quit gently with a big message pg_version=`/usr/bin/pg_lsclusters | grep 5432 | grep online | cut -d' ' -f1` if [ "x$pg_version" != "x" ] then export pg_hba_dir=/etc/postgresql/${pg_version}/main/ else echo "No database found online on port 5432" echo "Couldn't initialize or upgrade gforge database." echo "Please see postgresql documentation" echo "and run dpkg-reconfigure -plow gforge-db-postgresql" echo "once the problem is solved" echo "exiting without error, but gforge db will not work" echo "right now" exit 0 fi else export pg_hba_dir=/etc/postgresql fi set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see /usr/share/doc/packaging-manual/ . /usr/share/debconf/confmodule case "$1" in remove) # Remove our database /usr/lib/gforge/bin/install-db.sh purge # Unpatch DB configuration files /usr/lib/gforge/bin/install-db.sh purge-files ucf --debconf-ok ${pg_hba_dir}/pg_hba.conf.gforge-new ${pg_hba_dir}/pg_hba.conf rm ${pg_hba_dir}/pg_hba.conf.gforge-new ucf --purge ${pg_hba_dir}/pg_hba.conf pg_name=postgresql-$pg_version invoke-rc.d ${pg_name} reload ;; upgrade|deconfigure|failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0