+++ /dev/null
-#! /bin/sh
-# postinst script for @OLDPACKAGE@
-#
-# 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=`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 @OLDPACKAGE@ database."
- echo "Please see postgresql documentation"
- echo "and run dpkg-reconfigure -plow @OLDPACKAGE@-db-postgresql"
- echo "once the problem is solved"
- echo "exiting without error, but @OLDPACKAGE@ db will not work"
- echo "right now"
- exit 0
- fi
-else
- export pg_hba_dir=/etc/postgresql
-fi
-
-set -e
-#set -x # Be verbose, be very verbose.
-
-# summary of how this script can be called:
-# * <postinst> `configure' <most-recently-configured-version>
-# * <old-postinst> `abort-upgrade' <new version>
-# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-# <new-version>
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see /usr/share/doc/packaging-manual/
-#
-# quoting from the policy:
-# Any necessary prompting should almost always be confined to the
-# post-installation script, and should be protected with a conditional
-# so that unnecessary prompting doesn't happen if a package's
-# installation fails and the `postinst' is called with `abort-upgrade',
-# `abort-remove' or `abort-deconfigure'.
-
-. /usr/share/debconf/confmodule
-
-#DSFHELPER:handle-mainconffile#
-case "$1" in
- configure)
- add_onevar_mainconfile default_trove_cat 18
-
- # Patch DB configuration files
- /usr/share/@OLDPACKAGE@/bin/install-db.sh configure-files
-
- # At first, the pg_hba.conf file is not yet handled by ucf, so
- # we don't display the usual template, but instead a custom
- # one (fusionforge/ucfchangeprompt)
- ucf_package=`ucfq -w ${pg_hba_dir}/pg_hba.conf | cut -d ':' -f 2`
- if [ "x$ucf_package" != "x@OLDPACKAGE@-db-postgresql" ]
- then
- ucf --debconf-ok --debconf-template fusionforge/ucfchangeprompt ${pg_hba_dir}/pg_hba.conf.@OLDPACKAGE@-new ${pg_hba_dir}/pg_hba.conf
- else
- ucf --debconf-ok ${pg_hba_dir}/pg_hba.conf.@OLDPACKAGE@-new ${pg_hba_dir}/pg_hba.conf
- fi
- # register it with ucfr/ucfq so that next time the normal ucf template is used, in case of user changes (or another package's)
- ucfr @OLDPACKAGE@-db-postgresql ${pg_hba_dir}/pg_hba.conf
- rm ${pg_hba_dir}/pg_hba.conf.@OLDPACKAGE@-new
-
- # Make sure the database accepts connections from these new users
- pg_name=postgresql-$pg_version
- # Trying "postgresql" init script...
- v=0
- invoke-rc.d postgresql reload || v=$?
- if test x"$v" = x"100"; then
- # No "postgresql" init script (for packages << 8.4.4-2)
- pg_name=postgresql-$pg_version
- invoke-rc.d ${pg_name} reload
- elif test x"$v" != x"0"; then
- # Needed, since we run under "set -e"...
- exit $v
- fi
-
- # Setup our DB
- v=0
- /usr/share/@OLDPACKAGE@/bin/install-db.sh configure || v=$?
- if test x"$v" = x"100"; then
- db_get @PACKAGE@/shared/admin_password || true
- /usr/share/gforge/bin/forge_set_password admin "$RET"
- elif test x"$v" != x"0"; then
- exit $v
- fi
-
- if [ -n "$2" ] && dpkg --compare-versions $2 lt 5.1-8 ; then
- echo "Normalizing all roles and permissions"
- PATH=$PATH:/usr/share/gforge/bin normalize_roles.php
- fi
-
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst 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