2 # postinst script for gforge
4 # see: dh_installdeb(1)
6 # Support for new place for pg_hba.conf
7 # I only try to upgrade on the default cluster
8 if [ -x /usr/bin/pg_lsclusters ]
10 # We are with new postgresql working with clusters
11 # This is probably not te most elegant way to deal with database
12 # I install or upgrade on the default cluster if it is online
13 # or I quit gently with a big message
14 pg_version=`/usr/bin/pg_lsclusters | grep 5432 | grep online | cut -d' ' -f1`
15 if [ "x$pg_version" != "x" ]
17 export pg_hba_dir=/etc/postgresql/${pg_version}/main
19 echo "No database found online on port 5432"
20 echo "Couldn't initialize or upgrade gforge database."
21 echo "Please see postgresql documentation"
22 echo "and run dpkg-reconfigure -plow gforge-db-postgresql"
23 echo "once the problem is solved"
24 echo "exiting without error, but gforge db will not work"
29 export pg_hba_dir=/etc/postgresql
33 #set -x # Be verbose, be very verbose.
35 # summary of how this script can be called:
36 # * <postinst> `configure' <most-recently-configured-version>
37 # * <old-postinst> `abort-upgrade' <new version>
38 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
40 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
41 # <failed-install-package> <version> `removing'
42 # <conflicting-package> <version>
43 # for details, see /usr/share/doc/packaging-manual/
45 # quoting from the policy:
46 # Any necessary prompting should almost always be confined to the
47 # post-installation script, and should be protected with a conditional
48 # so that unnecessary prompting doesn't happen if a package's
49 # installation fails and the `postinst' is called with `abort-upgrade',
50 # `abort-remove' or `abort-deconfigure'.
52 . /usr/share/debconf/confmodule
54 #DSFHELPER:handle-mainconffile#
57 add_onevar_mainconfile default_trove_cat 18
61 # Patch DB configuration files
62 /usr/share/gforge/bin/install-db.sh configure-files
63 ucf --debconf-ok ${pg_hba_dir}/pg_hba.conf.gforge-new ${pg_hba_dir}/pg_hba.conf
64 rm ${pg_hba_dir}/pg_hba.conf.gforge-new
66 # Make sure the database accepts connections from these new users
67 pg_name=postgresql-$pg_version
68 invoke-rc.d ${pg_name} reload
71 /usr/share/gforge/bin/install-db.sh configure
74 abort-upgrade|abort-remove|abort-deconfigure)
78 echo "postinst called with unknown argument \`$1'" >&2
83 # dh_installdeb will replace this with shell code automatically
84 # generated by other debhelper scripts.