source: trunk/debathena/config/from-config/debian/postinst-alternatives @ 25077

Revision 25077, 2.3 KB checked in by jdreed, 13 years ago (diff)
In from-config: * Actually spell "alternatives" correct when calling update-alternatives
RevLine 
[25028]1#!/bin/sh
2# postinst script for debathena-from-config
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20#DEBHELPER#
21
22package=debathena-from-config
23ours=.debathena
24theirs=.debathena-orig
25
26undivert_unlink_symlink()
27{
28    file="$1"
29    ourfile="$2"
30    theirfile="$3"
31    if [ ! -L "$file" ] || \
32        [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
33          "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
34        echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
35    else
36        rm -f "$file"
37    fi
38}
39
40undivert_unlink_divert()
41{
42    file="$1"
43    if [ ! -L "$file" ] && [ ! -e "$file" ]; then
44        dpkg-divert --remove --rename --package "$package" "$file"
45    else
46        echo "Not removing diversion of $file by $package" >&2
47    fi
48}
49
50undivert_unlink()
51{
52    prefix=$1
53    suffix=$2
54
55    file=$prefix$suffix
56    ourfile=$prefix$ours$suffix
57    theirfile=$prefix$theirs$suffix
58
59    undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
60    undivert_unlink_divert "$file" "$package"
61}
62
63cleanup_old_diversion() {
64    file="$1"
65    if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
66        undivert_unlink "$file"
67    fi
68}
69
70case "$1" in
71    configure)
72        cleanup_old_diversion /usr/bin/from.debathena
73        cleanup_old_diversion /usr/share/man/man1/from.debathena.1.gz
[25077]74        update-alternatives \
[25028]75            --install /usr/bin/from from /usr/bin/from.debathena 100 \
76            --slave /usr/share/man/man1/from.1.gz from.1.gz /usr/share/man/man1/from.debathena.1.gz
77    ;;
78
79    abort-upgrade|abort-remove|abort-deconfigure)
80    ;;
81
82    *)
83        echo "postinst called with unknown argument \`$1'" >&2
84        exit 1
85    ;;
86esac
87
88exit 0
Note: See TracBrowser for help on using the repository browser.