Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 149 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh
# postinst script for pike8.0

set -e

PIKE=8.0
PIKEBIN=pike${PIKE}

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.
LOCAL_DIRS="lib/pike${PIKE}/modules lib/pike${PIKE}/include"

update_modules () {
    # Unfortunately we more or less have to delete all .o files and
    # redump everything, because although master.pike won't use a .o
    # file that is older than its corresponding source, modules often
    # contain compile-time conditionals like 
    #
    #   #if constant(Mysql.mysql)
    #
    # If the Mysql module is not installed, the code inside that
    # conditional block will not be compiled, and the referring module
    # won't be detected as out-of-date if the Mysql module is later
    # installed.
    find /usr/lib/$PIKEBIN -name '*.o' -delete
    $PIKEBIN -x dump --distquiet -r /usr/lib/$PIKEBIN/modules /usr/lib/$PIKEBIN/?.?/modules
}

case "$1" in
    configure)
    update-alternatives --install /usr/bin/pike pike /usr/bin/${PIKEBIN} 14 \
    --slave /usr/share/man/man1/pike.1.gz pike.1.gz /usr/share/man/man1/${PIKEBIN}.1.gz
    #
    # If the creation fails, so be it, user might have the filesystem mounted r/o
    #
    for d in $LOCAL_DIRS; do
        if [ ! -d /usr/local/$d ]; then
            install -d -m 755 -o root -g root /usr/local/$d || true
        fi
    done

    update_modules
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    triggered)
        update_modules
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0