File: libpgsql2.preinst.in

package info (click to toggle)
postgresql 6.5.3-27
  • links: PTS
  • area: main
  • in suites: potato
  • size: 28,360 kB
  • ctags: 20,905
  • sloc: ansic: 204,608; yacc: 10,718; sql: 9,387; sh: 9,379; java: 8,835; tcl: 7,709; makefile: 3,376; lex: 1,642; perl: 1,034; python: 959; cpp: 847; asm: 70; pascal: 42; awk: 10; sed: 8
file content (57 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
#include <genscript.warning>

#include <get_old_bins.inc>

SHELL=/bin/sh
export dpkg_action=$1

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

if [ -r /etc/postgresql/postgresql.env ]
then
	set -a
	. /etc/postgresql/postgresql.env
	set +a
fi

echo
if [ -d ${PGDATA:=/var/lib/postgres/data} ]
then
	installed=`cat ${PGDATA}/PG_VERSION 2>/dev/null`
	if [ -n "${installed}" ]
	then
		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
				echo Saving old binaries
				get_old_bins ${installed} $2
			else
				# A previous install should already have saved the binaries
				# we want
				echo Old binaries should already have been saved.
			fi
	
		fi
	fi
else
	# there was no database where we are going to put the new one,
	# but the executables of an older package might be left around
	# and might be needed to do a dump
	
	if [ -d /usr/lib/postgresql/bin -a "$1" != upgrade ]
	then
		get_old_bins unknown
	fi
fi

#DEBHELPER#

exit 0