File: postgresql-client.preinst.in

package info (click to toggle)
postgresql 7.4.7-6sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,168 kB
  • ctags: 27
  • sloc: sh: 1,903; makefile: 337; ansic: 204; perl: 69; sed: 6; tcl: 1
file content (50 lines) | stat: -rw-r--r-- 1,270 bytes parent folder | download
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
#! /bin/bash
set -e
#include <genscript.warning>
#include <dumpall_loc.inc>
#include <savebin.inc>

if [ "$1" = install -o "$1" = upgrade ]
then

current=%PG_VERSION%
lastinstall=`echo $2 | cut -d\- -f1 | cut -d. -f1-2`

# determine data location PGDATA
if [ -r /etc/postgresql/postmaster.conf ]
then
    . /etc/postgresql/postmaster.conf
fi
PGDATA="${POSTGRES_DATA:=/var/lib/postgres/data}"

# From 7.4.2-5 on, all binaries and libraries are saved in the prerms. But
# versions before don't save libraries, so we have to additionaly do that here
# for a transition period (i. e. until the Sarge release).
if [ -d "$PGDATA" ] && [ -f "$PGDATA/PG_VERSION" ]
then
    installed=`cat ${PGDATA}/PG_VERSION 2>/dev/null || true`
    if [ A"${installed}" != A${current} ]
    then
	# This is where we should end up for
	# an existing Debian package that
	# conflicts with this one and for
	# a non-Debian installation that
	# happens to be in our standard location

	if [ "A${lastinstall}" = "A${installed}" ]
	then
	    PKGVERSION="$installed"
	    for i in /usr/lib/postgresql/bin/{pg_dump,pg_dumpall,psql}
	    do
		save_bin $i
	    done
	    save_file /etc/postgresql/postgresql.env
	fi
    fi
fi

fi # for 'if $1 = install|upgrade' at the top of file

#DEBHELPER#

exit 0