source: trunk/debathena/config/gconf2-config/debian/debathena-gconf2-config.postinst @ 24501

Revision 24501, 3.3 KB checked in by broder, 14 years ago (diff)
In gconf2-config, don't make any changes until after config-package-dev is done. It turns out that ucf's arguably misguided symlink handling causes problems if we try to do the assorted cleanup before config-package-dev swaps out its diversions. To avoid these issues, figure out what's going on before we add and remove diversions, but don't do anything until after.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# postinst script for debathena-gconf2-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
20unmodified_path_files="
2142fc7033476d0ef67c6128de8ba37743
225fe9d96b799feb9265cdba9e91d5fc87
23886ab9a6f0d1454dbbc7174c98f82541
24c04694fa5852f2ccdb66d477e2166b30
25c6707181dfe36c2df1236cf59d19eb40
26d63e8f10e2be329d4c7a8300cf9adb24
27dfaf90cd2b9295854aac7dafc43d3ef1
28e26c499b34306eb817ffff97dfaa22fc
29e85c1fff42b26376b545370be5fb0a99
30f4675a2f84af10bb8d2b04305b235dff
31"
32
33# Figure out if we think that /etc/gconf/2/path has been intentionally
34# modified by the user
35#
36# There are two types of conflicts:
37#  1: User modified /etc/gconf/2/path.debathena, but left the path ->
38#     path.debathena symlink in place
39#  2: User changed the /etc/gconf/2/path symlink
40#
41# We have to figure out what's going on before undoing the diversion
42# (which will happen in the debhelper block). But we can't actually do
43# anything about it until afterwards, because of ucf's broken symlink
44# handling.
45conflict=0
46path=/etc/gconf/2/path
47if [ "$1" = "configure" ] && \
48    dpkg --compare-versions "$2" lt-nl 1.7~; then
49    if [ "$(readlink -n "$path")" = "path.debathena" ]; then
50        if [ -r $path.debathena ] && \
51            echo "$unmodified_path_files" | \
52            grep -Fxq "$(md5sum "$path.debathena" | awk '{ print $1 }')"; then
53            # Definitely pristine
54            conflict=0
55        else
56            # User modified /etc/gconf/2/path.debathena
57            conflict=1
58        fi
59    else
60        # User changed /etc/gconf/2/path symlink
61        conflict=2
62    fi
63fi
64
65# dh_installdeb will replace this with shell code automatically
66# generated by other debhelper scripts.
67
68#DEBHELPER#
69
70case "$1" in
71    configure)
72        if dpkg --compare-versions "$2" lt-nl 1.7~; then
73            if [ "$conflict" = 0 ]; then
74                ucf --purge /etc/gconf/2/path
75                rm -f /etc/gconf/2/path
76            else
77                # Force a ucf conflict
78                sed -i -re 's,^[0-9a-f]{32}  (/etc/gconf/2/path)$,00000000000000000000000000000000  \1,' /var/lib/ucf/hashfile
79
80                # If /etc/gconf/2/path was really path.debathena
81                # before, make sure it still is when we run ucf next
82                if [ "$conflict" = 1 ]; then
83                    if [ -r /etc/gconf/2/path.debathena ]; then
84                        mv /etc/gconf/2/path.debathena /etc/gconf/2/path || :
85                    else
86                        mv /etc/gconf/2/path /etc/gconf/2/path.old || :
87                    fi
88                fi
89            fi
90        fi
91        ucf /usr/share/gconf/default.path /etc/gconf/2/path
92    ;;
93
94    abort-upgrade|abort-remove|abort-deconfigure)
95    ;;
96
97    *)
98        echo "postinst called with unknown argument \`$1'" >&2
99        exit 1
100    ;;
101esac
102
103exit 0
104
105
Note: See TracBrowser for help on using the repository browser.