File: libpgsql2.preinst.in

package info (click to toggle)
postgresql 7.2.1-2woody8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 42,424 kB
  • ctags: 30,027
  • sloc: ansic: 290,568; java: 18,529; sh: 12,197; sql: 11,401; yacc: 11,189; tcl: 8,063; perl: 4,067; makefile: 3,332; xml: 2,874; lex: 2,799; python: 1,237; cpp: 845; pascal: 81; asm: 70; awk: 20; sed: 8
file content (57 lines) | stat: -rw-r--r-- 1,220 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/bash
#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