Subversion Repositories

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

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

#! /bin/sh
# postinst script for pike7.8
#
# see: dh_installdeb(1)
# 
# $Id: pike7.8-core.postinst,v 1.1 2006/01/17 22:37:48 grendel Exp $
#

set -e

PIKE=7.8
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 () {
    $PIKEBIN -x dump $@ --distquiet -r /usr/lib/$PIKEBIN/modules
    find /usr/lib/$PIKEBIN/modules -name '*.o' | sed 's/.o$//' |
    while read f; do 
        if [ ! -f $f ]; then
            rm -f $f.o
        fi
    done
}

case "$1" in
    configure)
    update-alternatives --install /usr/bin/pike pike /usr/bin/${PIKEBIN} 12 \
    --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 -u
    ;;

    *)
        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