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

Revision 24493, 2.8 KB checked in by broder, 14 years ago (diff)
In gconf2-config: * Configure gconf through /usr/share/gconf/default.path instead of /etc/gconf/2/path, as it makes ucf less likely to do dumb things. (Trac: #247)
  • 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# If we don't think /etc/gconf/2/path has been intentionally modified
34# by the user, then purge it from ucf's database to avoid presenting
35# conflicts
36conflict=0
37modified_path_debathena=0
38path=/etc/gconf/2/path
39if [ "$1" = "configure" ] && \
40    dpkg --compare-versions "$2" lt-nl 1.7~; then
41    if [ "$(readlink -n "$path")" = "path.debathena" ]; then
42        if [ -r $path.debathena ] && \
43            echo "$unmodified_path_files" | \
44            grep -Fxq "$(md5sum "$path.debathena" | awk '{ print $1 }')"; then
45            # Definitely pristine
46            ucf --purge "$path"
47            rm -f "$path" "$path.debathena" "$path.debathena-orig"
48        else
49            # User modified /etc/gconf/2/path.debathena - we'll have to
50            # deal with this later
51            modified_path_debathena=1
52            conflict=1
53        fi
54    else
55        # User changed /etc/gconf/2/path.debathena-orig symlink
56        conflict=1
57    fi
58fi
59
60if [ "$conflict" = 1 ]; then
61    # Force a ucf conflict. We are terrible people
62    sed -i -re 's,^[0-9a-f]{32}  (/etc/gconf/2/path)$,00000000000000000000000000000000  \1,' /var/lib/ucf/hashfile
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 the user modified /etc/gconf/2/path.debathena without
73        # changing the symlink, then move their changed file to
74        # /etc/gconf/2/path
75        if dpkg --compare-versions "$2" lt-nl 1.7~ && \
76            [ "$modified_path_debathena" = 1 ]; then
77            if [ -r /etc/gconf/2/path.debathena ]; then
78                mv /etc/gconf/2/path.debathena /etc/gconf/2/path || :
79            else
80                mv /etc/gconf/2/path /etc/gconf/2/path.old || :
81            fi
82        fi
83        ucf /usr/share/gconf/default.path /etc/gconf/2/path
84    ;;
85
86    abort-upgrade|abort-remove|abort-deconfigure)
87    ;;
88
89    *)
90        echo "postinst called with unknown argument \`$1'" >&2
91        exit 1
92    ;;
93esac
94
95exit 0
96
97
Note: See TracBrowser for help on using the repository browser.