File: pike7.8-core.postinst

package info (click to toggle)
pike7.8 7.8.866-7
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 69,304 kB
  • ctags: 28,082
  • sloc: ansic: 252,877; xml: 36,537; makefile: 4,214; sh: 2,879; lisp: 655; asm: 591; objc: 212; pascal: 157; sed: 34
file content (84 lines) | stat: -rw-r--r-- 2,605 bytes parent folder | download | duplicates (3)
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
#! /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 () {
    # 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} 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
    ;;

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