source: trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst @ 25625

Revision 25625, 2.5 KB checked in by jdreed, 12 years ago (diff)
In firefox-extension: * dpkg-query returns non-zero if a package doesn't exist
Line 
1#!/bin/sh
2# postinst script for debathena-firefox-extension
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# dh_installdeb will replace this with shell code automatically
21# generated by other debhelper scripts.
22
23#DEBHELPER#
24
25case "$1" in
26    configure)
27        # In 0.9~rc2-0ubuntu2, the conffile moved to /etc/xul-ext
28        # and we horribly broke things.  Let's attempt to unbreak them:
29        if dpkg-query -W ubufox 2>/dev/null 2>&1 && dpkg --compare-versions "$(dpkg-query -W -f '${Version}' ubufox)" ge "0.9~rc2-0ubuntu2" && [ -d /etc/firefox-3.0/pref ]; then
30            # The file should have been undiverted at this point
31            echo "*** The previous OMINOUS WARNING may be safely ignored ***" >&2
32            # If there are files in the location, move them to
33            # the new location, unless the user has already done that
34            # and that will restore any broken symlinks.
35            for f in $(ls /etc/firefox-3.0/pref/ubufox.js.debathena*); do
36                mv -u "$f" /etc/xul-ext
37            done
38            new_file=/etc/xul-ext/ubufox.js
39            if [ -L "$new_file" ] &&
40               [ ! -e "$(readlink -f "$new_file")" ]; then
41                # If the link target is still missing, copy over upstream's
42                # new config file, or upstream's old config file, or give up
43                if [ -f /etc/xul-ext/ubufox.js.dpkg-new ]; then
44                    mv -f /etc/xul-ext/ubufox.js.dpkg-new /etc/xul-ext/ubufox.js
45                elif [ -f /etc/xul-ext/ubufox.js.debathena-orig ]; then
46                    mv -f /etc/xul-ext/ubufox.js.debathena-orig /etc/xul-ext/ubufox.js
47                else
48                    echo "*** Manual inspection and cleanup of /etc/xul-ext/ubufox.js may be required"
49                fi
50            fi
51        fi
52        if [ -d /usr/lib/firefox/extensions ] && ! [ -h /usr/lib/firefox/extensions ] && ! [ -e /usr/lib/firefox/extensions/athena@mit.edu ]; then
53            ln -s /usr/lib/debathena-firefox-extension /usr/lib/firefox/extensions/athena@mit.edu
54        fi
55    ;;
56
57    abort-upgrade|abort-remove|abort-deconfigure)
58    ;;
59
60    *)
61        echo "postinst called with unknown argument \`$1'" >&2
62        exit 1
63    ;;
64esac
65
66exit 0
Note: See TracBrowser for help on using the repository browser.