source: trunk/debathena/config/kerberos-config/debian/debathena-kerberos-config.postinst @ 24288

Revision 24288, 3.4 KB checked in by broder, 15 years ago (diff)
In kerberos-config: * Test for krb5 1.7 using krb5-user instead of krb5-clients, since krb5-clients is being seprated into a separate source package.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# postinst script for debathena-kerberos-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
20package=debathena-kerberos-config
21ours=.debathena
22theirs=.debathena-orig
23
24undivert_unlink_symlink()
25{
26    file="$1"
27    ourfile="$2"
28    theirfile="$3"
29    if [ ! -L "$file" ] || \
30        [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
31          "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
32        echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
33    else
34        rm -f "$file"
35    fi
36}
37
38undivert_unlink_divert()
39{
40    file="$1"
41    if [ ! -L "$file" ] && [ ! -e "$file" ]; then
42        dpkg-divert --remove --rename --package "$package" "$file"
43    else
44        echo "Not removing diversion of $file by $package" >&2
45    fi
46}
47
48undivert_unlink()
49{
50    prefix=$1
51    suffix=$2
52
53    file=$prefix$suffix
54    ourfile=$prefix$ours$suffix
55    theirfile=$prefix$theirs$suffix
56
57    undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
58    undivert_unlink_divert "$file" "$package"
59}
60
61cleanup_old_diversion() {
62    file="$1"
63    if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
64        undivert_unlink "$file"
65    fi
66}
67
68cleanup_old_removal() {
69    file="$1"
70    removedfile="$2"
71    if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${removedfile} by ${package}"; then
72        undivert_unlink_divert "$file"
73    fi
74}
75
76case "$1" in
77    configure)
78        if dpkg-query -f '${Conffiles}\n' -W debathena-kerberos-config | grep '/etc/apparmor.d/usr.sbin.cups.debathena' | awk '{ print $2"  "$1 }' | md5sum -c >/dev/null 2>&1; then
79            rm -f /etc/apparmor.d/usr.sbin.cups.debathena
80        fi
81
82        # The cupsd config can be removed, but not diverted; the
83        # kerberosclient config can be diverted but not removed. Since
84        # both files have been both at various points in the package's
85        # history, if one of them is wrong, fix it before putting the
86        # diversion back in later on.
87        cleanup_old_diversion /etc/apparmor.d/usr.sbin.cupsd
88        cleanup_old_removal /etc/apparmor.d/abstractions/kerberosclient /usr/share/debathena-kerberos-config/etc++apparmor.d++abstractions++kerberosclient
89
90        # Handle upgrading from a system with krb4 to one without
91        krb5_version="$(dpkg-query -W -f '${Version}' krb5-user)"
92        if dpkg --compare-versions "$krb5_version" ge "1.7~"; then
93            cleanup_old_diversion /etc/krb.conf
94            cleanup_old_diversion /etc/krb.realms
95        fi
96
97        if hash invoke-rc.d 2>/dev/null; then
98            invoke-rc.d apparmor reload || :
99        else
100            /etc/init.d/apparmor reload || :
101        fi
102    ;;
103
104    abort-upgrade|abort-remove|abort-deconfigure)
105    ;;
106
107    *)
108        echo "postinst called with unknown argument \`$1'" >&2
109        exit 1
110    ;;
111esac
112
113# dh_installdeb will replace this with shell code automatically
114# generated by other debhelper scripts.
115
116#DEBHELPER#
117
118exit 0
119
120
Note: See TracBrowser for help on using the repository browser.