[24493] | 1 | #!/bin/sh |
---|
| 2 | # postinst script for debathena-gconf2-config |
---|
| 3 | # |
---|
| 4 | # see: dh_installdeb(1) |
---|
| 5 | |
---|
| 6 | set -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 | unmodified_path_files=" |
---|
| 21 | 42fc7033476d0ef67c6128de8ba37743 |
---|
| 22 | 5fe9d96b799feb9265cdba9e91d5fc87 |
---|
| 23 | 886ab9a6f0d1454dbbc7174c98f82541 |
---|
| 24 | c04694fa5852f2ccdb66d477e2166b30 |
---|
| 25 | c6707181dfe36c2df1236cf59d19eb40 |
---|
| 26 | d63e8f10e2be329d4c7a8300cf9adb24 |
---|
| 27 | dfaf90cd2b9295854aac7dafc43d3ef1 |
---|
| 28 | e26c499b34306eb817ffff97dfaa22fc |
---|
| 29 | e85c1fff42b26376b545370be5fb0a99 |
---|
| 30 | f4675a2f84af10bb8d2b04305b235dff |
---|
| 31 | " |
---|
| 32 | |
---|
[24501] | 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. |
---|
[24493] | 45 | conflict=0 |
---|
| 46 | path=/etc/gconf/2/path |
---|
| 47 | if [ "$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 ] && \ |
---|
[24501] | 51 | echo "$unmodified_path_files" | \ |
---|
[24493] | 52 | grep -Fxq "$(md5sum "$path.debathena" | awk '{ print $1 }')"; then |
---|
| 53 | # Definitely pristine |
---|
[24501] | 54 | conflict=0 |
---|
[24493] | 55 | else |
---|
[24501] | 56 | # User modified /etc/gconf/2/path.debathena |
---|
[24493] | 57 | conflict=1 |
---|
| 58 | fi |
---|
| 59 | else |
---|
[24501] | 60 | # User changed /etc/gconf/2/path symlink |
---|
| 61 | conflict=2 |
---|
[24493] | 62 | fi |
---|
| 63 | fi |
---|
| 64 | |
---|
| 65 | # dh_installdeb will replace this with shell code automatically |
---|
| 66 | # generated by other debhelper scripts. |
---|
| 67 | |
---|
| 68 | #DEBHELPER# |
---|
| 69 | |
---|
| 70 | case "$1" in |
---|
| 71 | configure) |
---|
[24501] | 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 |
---|
[24493] | 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 | ;; |
---|
| 101 | esac |
---|
| 102 | |
---|
| 103 | exit 0 |
---|
| 104 | |
---|
| 105 | |
---|