prerm is in libc6 2.15-0ubuntu10.
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 | #!/bin/sh
set -e
export LC_ALL=C
type=$1
if [ "x$2" != "xin-favour" ]; then
    preversion=$2
fi
restore_lib64_symlink() {
# Downgrading from a version with a /lib64 directory to a version with
# a /lib64 symlink is extremely dangerous.  We need to move the
# directory aside and restore the symlink, otherwise the dynamic
# linker gets lost after unpacking the replacing version.
    ldfile=$(readlink -e /lib64/ld-linux-x86-64.so.2)
    # Test if libc is of the same architecture as coreutils
    # If not, they almost surely have a multiarch system and we can use
    # the native ELF interpreter
    if ! $ldfile /bin/true 2>/dev/null; then
	interpreter=
    else
	interpreter=$ldfile
    fi
    # Create the symlink in /lib again
    cp -a /lib64/ld-linux-x86-64.so.2 /lib/
    # sync before and after the operation to reduce the danger of hosing
    # the system
    sync
    # See if they have anything in /lib64 besides the ELF interpreter.
    # If yes, move the directory aside so they can restore it later,
    # otherwise we just remove it.
    if ls -1A /lib64 | grep -vq "^$(basename /lib64/ld-linux-x86-64.so.2)$"; then
	echo "Warning: /lib64 not empty during libc downgrade, renaming it to /lib64.eglibc-old"
	mv /lib64 /lib64.eglibc-old
    else
	rm -rf /lib64
    fi
    $interpreter /bin/ln -s /lib /lib64
    sync
}
if [ "$type" = upgrade ]; then
    if dpkg --compare-versions "$preversion" lt 2.13-17; then
	if ! test -L /lib64; then
	    case ${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)} in
		amd64 | ppc64 | sparc64)
		    restore_lib64_symlink ;;
	    esac
	fi
    fi
fi
if [ -n "$preversion" ]; then
    if dpkg --compare-versions "$preversion" lt 2.13; then
        # downgrading from a multiarch libc to a pre-multiarch libc; we have
        # to blow away /etc/ld.so.cache, otherwise the old unpacked libc
        # is still first in the cache and segfaults when combined with
        # our newly-unpacked ld.so. 
        rm -f /etc/ld.so.cache
    fi
fi
exit 0
 |