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

Revision 25570, 2.5 KB checked in by jdreed, 12 years ago (diff)
In firefox-extension: * Don't symlink onto something that exists
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        ubufox_version="$(dpkg-query -W -f '${Version}' ubufox)"
30        if dpkg --compare-versions "$ubufox_version" ge "0.9~rc2-0ubuntu2" && [ -d /etc/firefox-3.0/pref ]; then
31            # The file should have been undiverted at this point
32            echo "*** The previous OMINOUS WARNING may be safely ignored ***" >&2
33            # If there are files in the location, move them to
34            # the new location, unless the user has already done that
35            # and that will restore any broken symlinks.
36            for f in $(ls /etc/firefox-3.0/pref/ubufox.js.debathena*); do
37                mv -u "$f" /etc/xul-ext
38            done
39            new_file=/etc/xul-ext/ubufox.js
40            if [ -L "$new_file" ] &&
41               [ ! -e "$(readlink -f "$new_file")" ]; then
42                # If the link target is still missing, copy over upstream's
43                # new config file, or upstream's old config file, or give up
44                if [ -f /etc/xul-ext/ubufox.js.dpkg-new ]; then
45                    mv -f /etc/xul-ext/ubufox.js.dpkg-new /etc/xul-ext/ubufox.js
46                elif [ -f /etc/xul-ext/ubufox.js.debathena-orig ]; then
47                    mv -f /etc/xul-ext/ubufox.js.debathena-orig /etc/xul-ext/ubufox.js
48                else
49                    echo "*** Manual inspection and cleanup of /etc/xul-ext/ubufox.js may be required"
50                fi
51            fi
52        fi
53        if [ -d /usr/lib/firefox/extensions ] && ! [ -h /usr/lib/firefox/extensions ] && ! [ -e /usr/lib/firefox/extensions/athena@mit.edu ]; then
54            ln -s /usr/lib/debathena-firefox-extension /usr/lib/firefox/extensions/athena@mit.edu
55        fi
56    ;;
57
58    abort-upgrade|abort-remove|abort-deconfigure)
59    ;;
60
61    *)
62        echo "postinst called with unknown argument \`$1'" >&2
63        exit 1
64    ;;
65esac
66
67exit 0
Note: See TracBrowser for help on using the repository browser.