#!/bin/sh
set -e

# begin-remove-after: released:forky
if [ "$1" = configure ]; then
    # These symbolic links are either included in base-files or created by
    # base-files via triggers, but we also create them to avoid a versioned
    # dependency on base-files. Cleanup will be handled by base-files.
    if ! [ -h "$DPKG_ROOT/lib" ]; then
        ln -s "usr/lib" "$DPKG_ROOT/lib"
    fi
    if ! [ -h "$DPKG_ROOT/lib32" ]; then
        ln -s usr/lib32 "$DPKG_ROOT/lib32"
    fi
fi
# end-remove-after

if [ "$1" = configure -o "$1" = triggered ] && ! [ -h "$DPKG_ROOT/usr/lib/ld-linux.so.2" ]; then
    # In principle, this package should contain this link, but it also is
    # contained in the multiarch libc package. To avoid a conflict and the need
    # for declaring Replaces (which work badly with the /usr-move due to
    # aliasing), we manually create this link whenever we are installed or
    # upgraded or the multiarch libc is installed, upgraded or importantly
    # removed. The link target is given as absolute without /usr. The runtime
    # linker directory is always one level deep, so we can simply prepend "..".
    ln -s ../lib32/ld-linux.so.2 "$DPKG_ROOT/usr/lib/ld-linux.so.2"
fi



exit 0
