This file is indexed.

preinst is in dpkg 1.17.5ubuntu5.6.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
#!/bin/sh
# This script can be called in the following ways:
#
# Before the package is installed:
#	<new-preinst> install
#
# Before removed package is upgraded:
#	<new-preinst> install <old-version>
#
# Before the package is upgraded:
#	<new-preinst> upgrade <old-version>
#
#
# If postrm fails during upgrade or fails on failed upgrade:
#	<old-preinst> abort-upgrade <new-version>

set -e

# Handle upgrades from pre-conffile dpkg.cfg
upgrade_dpkg_non_conffile()
{
    if [ -r /etc/dpkg/dpkg.cfg ]; then
	dpkg_cfg_md5="535552ad5ee9145dbc7a34c264df4e59  /etc/dpkg/dpkg.cfg"
	if echo "$dpkg_cfg_md5" | md5sum -c >/dev/null 2>&1; then
	    echo "Removing non-modified dpkg.cfg to be replaced by a conffile ..."
	    rm -f /etc/dpkg/dpkg.cfg
	fi
    fi
}

rename_multiarch_conffile()
{
    if [ -f /etc/dpkg/dpkg.cfg.d/multiarch ]; then
        multiarch_md5="e018c53338191b34f943e2b38e160d1a  /etc/dpkg/dpkg.cfg.d/multiarch"
        if echo "$multiarch_md5" | md5sum -c >/dev/null 2>&1; then
            mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-remove
        else
            mv /etc/dpkg/dpkg.cfg.d/multiarch /etc/dpkg/dpkg.cfg.d/multiarch.dpkg-backup
        fi
    fi
}

kill_bad_alternatives () {
    local IFS=""
    admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
    ALTDIR="$admindir/alternatives"
    for alt in $ALTDIR/*; do
        if [ ! -f $alt ]; then
            # In case it's been removed by the code below, or in case
            # it's not a real file
            continue
        fi
        {
            read mode || continue
            read mainlink || continue
            while true; do
                read slave || break
                if [ "$slave" = "" ]; then
                    break
                fi
                if [ -e "$ALTDIR/$slave" ]; then
                    echo "Removing conflicting master alternative $slave (it is slave of $(basename $alt))..."
                    rm -f "$ALTDIR/$slave"
                fi
                read slavelink || break
            done
        } <$alt
    done
}

case "$1" in
    install)
	;;

    upgrade)
        # Cleanup bad alternatives that would choke with new
        # update-alternatives (see #530633, #531611, #532739, #521760)
        if dpkg --compare-versions "$2" lt 1.15.3; then
            kill_bad_alternatives
        fi

        if dpkg --compare-versions "$2" lt 1.16.3; then
            rename_multiarch_conffile
        fi

	case "$2" in
	    # Upgrade from pre-conffile dpkg.cfg
	    1.9.21 | 1.10.* )
		upgrade_dpkg_non_conffile
		;;
	esac
	;;

    abort-upgrade)
	;;


    *)
	echo "$0 called with unknown argument \`$1'" 1>&2
	exit 1
	;;
esac


exit 0