summaryrefslogtreecommitdiff
path: root/debian/preinst
blob: b7a3b21bf41988ade1bc7e246c75b0f26b986dd7 (plain)
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
85
86
#!/bin/sh -

if [ "$1" != "upgrade" ]; then exit 0; fi

set -e
# i386elf: dpkg --assert-support-predepends

oldver="$2"

case "$oldver" in
	0.93.[01234]* | - )	;;
	* )			exit 0 ;;
esac

echo '
contemplating upgrade of dpkg from pre-0.93.50 version ...'

trap 'es=$?; rm -f /tmp/bp.$$; exit $es' 0

perl -000 -ne 'print $x if m/^Package:\s+(\S+\n)/im &&
			  ($x=$1) ne "dpkg\n" &&
			  m/^Status:.*(unpacked|postinst)/im' \
	/var/lib/dpkg/status >/tmp/bp.$$

if test -s /tmp/bp.$$
then
	echo '

WARNING - have you read the release notes for this upgrade ?

The following packages have been unpacked but not yet configured:'
	echo '' `cat /tmp/bp.$$`
	echo -n '
If you proceed with the dpkg upgrade with these packages in this state
you will LOSE ANY CONFIGURATION CHANGES that have been made to their
configuration files.  I recommend that you back out of the upgrade
now (see below) and then configure each of these packages using:
 dpkg --configure --force-hold <package>

If you do this and it fails for some packages they are broken anyway, in
which case you probably don'"'"'t have that much to lose by going ahead
with the upgrade.

Type "yes" to confirm that you really want to do the upgrade in
spite of my warning above; if you give any other response we'"'"'ll back
off the upgrade to give you a chance to fix things.

Continue with upgrade despite probable loss of config data ? '
	read response
	case "$response" in
	[Yy][Ye][Ss] )	echo OK ... ;;
	* )		echo 'Aborting dpkg upgrade.'; exit 1 ;;
	esac
fi

echo -n '
IMPORTANT - you must install this upgrade on its own, not together in
the same dpkg run as any other packages.  Otherwise you risk losing
configuration information.

If you say "no" to the question below we'"'"'ll back off the upgrade now,
and you can then do it later using:
 dpkg --install dpkg-0.93.51.deb
If you'"'"'re not sure what to do, say "no", and then run that command
(with the appropriate dpkg-*.deb filename) from a root shell prompt.

Are you installing only the dpkg upgrade in this dpkg run ? [y/n] '
read response
case "$response" in
[yY]* | '' )
	echo 'OK, going ahead.'
	;;
* )
	echo '
Aborting dpkg upgrade (you will see error messages from dpkg about this).'
	exit 1
	;;
esac

if [ -d /usr/lib/dpkg/methods/hd ]
then
	echo 'Removing obsolete /usr/lib/dpkg/methods/hd ...'
	rm -r /usr/lib/dpkg/methods/hd
fi

exit 0