This file is indexed.

prerm is in gforge-db-postgresql 5.1.1-2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /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=`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:
#        * <prerm> `remove'
#        * <old-prerm> `upgrade' <new-version>
#        * <new-prerm> `failed-upgrade' <old-version>
#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
#        * <deconfigured's-prerm> `deconfigure' `in-favour'
#          <package-being-installed> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/

. /usr/share/debconf/confmodule

case "$1" in
    remove)
        # Remove our database
	/usr/share/gforge/bin/install-db.sh purge

        # Unpatch DB configuration files
	/usr/share/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
	ucfr --purge gforge-db-postgresql ${pg_hba_dir}/pg_hba.conf

	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
	;;
    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.



exit 0