fi
}
-
-# Repair damage to /usr/info caused by broken install-info
-fix_damaged_info() {
- echo -n "
-The version of dpkg you're upgrading from had a problem with the
-install-info program used to maintain the /usr/info/dir file. It may
-have corrupted the file, for example by placing new entries for the
-menu in it before the \`* Menu' line (thus making them ineffective) or
-by creating several identical sections.
-
-I can try to sort these problems out, but beware that this process is
-not guaranteed not to mess up a dir file which has things that look
-like menu entries in the introductory paragraphs. The distributed dir
-files do not do this, so if you haven't edited /usr/info/dir it's
-almost certainly safe to say \"yes\" to the next question.
-
-If you say \"no\" you may wish to check and/or edit /usr/info/dir yourself.
-
-Try to check/repair /usr/info/dir automatically ? [y/n] "
- read response
- case "$response" in
- [yY]*|"")
- echo "Checking/repairing /usr/info/dir ..."
- cleanup-info --unsafe
- ;;
- *)
- echo "OK, leaving it alone."
- ;;
- esac
-}
-
-
-# Remove stop links from runlevels which also have start links
-# Dates back to the days when update-rc.d was part of dpkg.
-remove_duplicate_daemons() {
- for lvl in 0 1 2 3 4 5 6; do
- cd /etc/rc$lvl.d
- for kill in K[0-9][0-9]*; do
- if [ -n "`echo \"x$kill\" | tr -d 0-9A-Za-z_-`" ]; then
- continue
- fi
-
- start="`echo $kill | sed -e 's/^K/S/'`"
- if ! [ -L $start ] && [ -L $kill ] \
- || [ "`ls -Li $kill 2>/dev/null | awk '{print $1}'`" != \
- "`ls -Li $start 2>/dev/null | awk '{print $1}'`" ]
- then
- continue
- fi
-
- removes="$removes rc$lvl.d/$kill"
- done
- done
-
- if [ -n "$removes" ]; then
- echo -n "
-Some daemons and similar services whose scripts have links in the
-/etc/rcN.d directories have both start (S) and stop (K) links in
-some runlevels. Thus these services get stopped and immediately
-restarted at some runlevel changes, which is probably not what
-you want.
-
-I can remove these probably-spurious K links if you like:
- $removes
-
-If you're not sure what to do, say \"no\", and then run delete them
-by hand later.
-
-Shall I remove these links ? [y/n] "
- read response
- case "$response" in
- [yY]*|"")
- echo "Removing duplicate K links ..."
- cd /etc
- rm $removes
- ;;
- *)
- echo "OK, leaving them."
- ;;
- esac
- fi
-}
-
-
# Create log file and set default permissions if possible
create_logfile() {
logfile=/var/log/dpkg.log
create_database
create_logfile
- case "$2" in
- 0.* | 1.0.* | 1.1.0 | 1.1.0[^0-9]* | '' )
- remove_duplicate_daemons
- ;;
- 1.1.6 | 1.1.6elf | 1.2.[0123] | 1.2.[0123]elf)
- fix_damaged_info
- ;;
- esac
-
move_info_directory
remove_info_symlink
;;
# If postrm fails during upgrade or fails on failed upgrade:
# <old-preinst> abort-upgrade <new-version>
-
-# Confirm that users are aware that conffile changes will be lost
-confirm_conffile_stomp() {
- tempfile=/var/lib/dpkg/bp.$$
-
- trap 'status=$?; rm -f $tempfile; exit $status' 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 >$tempfile
-
- if [ -s $tempfile ]; then
- echo "
-WARNING - have you read the release notes for this upgrade ?
-
-The following packages have been unpacked but not yet configured:"
- echo " "`cat $tempfile`
-
- 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][Ee][Ss])
- echo "OK, going ahead."
- ;;
- *)
- echo "Aborting dpkg upgrade."
- exit 1
- ;;
- esac
- fi
-
- rm -f $tempfile
-}
-
-
-# Confirm that the user isn't upgrading anything else at the same time
-confirm_singleton() {
- 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."
- exit 1
- ;;
- esac
-}
-
-
-# Confirm that dselect got split into it's own package
-confirm_dselect_split() {
- if [ -x /bin/ps ]; then
- if ! ps -C dselect >/dev/null; then
- return
- fi
- fi
-
- if ! grep "^Package: *dselect$" /var/lib/dpkg/status >/dev/null; then
- echo -n "
-IMPORTANT - if you are upgrading this package from within dselect you
-_MUST_ install the dselect package first.
-
-The dselect frontend has been split into a separate \`dselect' package,
-which has not yet been unpacked onto your system. Continuing the upgrade
-will mean that dselect will temporarily be removed from your system, if
-this happens within dselect the upgrade will fail.
-
-Type \"yes\" to confirm that you really want to do the upgrade in
-spite of my warning above (because you're not running dselect, for
-example); if you give any other response we'll back off the upgrade to
-give you a change to install the dselect package first.
-
-Continue with upgrade despite separation of dselect ? "
-
- read response
- case "$response" in
- [Yy][Ee][Ss])
- echo "OK, going ahead."
- ;;
- *)
- echo "Aborting dpkg upgrade."
- exit 1
- ;;
- esac
- fi
-}
-
-
-# Remove obsolete hd method scripts
-remove_hd_method() {
- methoddir=/usr/lib/dpkg/methods/hd
-
- if [ -d $methoddir ]; then
- echo "Removing obsolete $methoddir ..."
- rm -r $methoddir
- fi
-}
-
-
# Handle upgrades from pre-conffile dpkg.cfg
upgrade_dpkg_non_conffile()
{
;;
upgrade)
- case "$2" in
- # Upgrade from non-C dpkg (pre-0.93.50)
- 0.93.[01234]* | -)
- echo ""
- echo "Contemplating upgrade of dpkg from pre-0.93.50 version ..."
-
- confirm_conffile_stomp
- confirm_singleton
- confirm_dselect_split
- remove_hd_method
- ;;
-
- # Upgrade from pre-dselect split
- 0.93.[5678][0-9]* | 1.[023456789]* | 1.1.* | 1.10 | 1.10.[12] )
- confirm_dselect_split
- ;;
- esac
case "$2" in
# Upgrade from pre-conffile dpkg.cfg
1.9.21 | 1.10.* )