~ubuntu-branches/ubuntu/natty/firefox/natty-updates

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh

set -e

LIBDIR=@LIBDIR@
APPNAME=@APPNAME@

if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] ; then
    if [ `dpkg-divert --truename /usr/bin/$APPNAME` != "/usr/bin/$APPNAME" ] ; then
        # Ubuntuzilla has trashed this install. Grrrrrrrrrr!
        BROKEN=1
    else
        BROKEN=0
    fi

    if [ ! -x /usr/bin/$APPNAME ] && [ "$BROKEN" = "1" ] ; then
        echo "***Your system has been left in a broken state by a third party package***"
        echo "This is usually caused by installing packages from Ubuntuzilla. Fixing this now"
        dpkg-divert --rename --remove /usr/bin/$APPNAME
        # Yay! We are sane again now \o/
        BROKEN=0
    fi

    if [ "$BROKEN" = "0" ] ; then
        update-alternatives --install /usr/bin/gnome-www-browser \
            gnome-www-browser /usr/bin/$APPNAME 40

        update-alternatives --install /usr/bin/x-www-browser \
            x-www-browser /usr/bin/$APPNAME 40
    else
        PACKAGE=`dpkg-divert --listpackage /usr/bin/$APPNAME`
        if [ "$PACKAGE" = "LOCAL" ] ; then
            echo "/usr/bin/$APPNAME has been diverted by a third party package which didn't specify"
            echo "a package name to dpkg-divert. This is usually as a result of installing unsupported"
            echo "packages from Ubuntuzilla."
            echo "***This is a BUG. Please report this bug to the vendor of the third party package you installed***"
        else
            echo "/usr/bin/$APPNAME has been diverted by $PACKAGE"
        fi
    fi

    #
    # AppArmor
    #
    APP_PROFILE="/etc/apparmor.d/usr.bin.$APPNAME"
    if [ -f "$APP_PROFILE" ]; then
	 if [ -e /etc/lsb-release ] ; then
            ubuntu_version=`grep ^DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2 | cut -d '.' -f-2 | tr -d '.'`
        else
            ubuntu_version=`lsb_release -rs | cut -d '.' -f-2 | tr -d '.'`
        fi

        # Setup the extra include files for Ubuntu 10.10 and higher
        if [ "$ubuntu_version" -ge '1010' ]; then
            # Add the local/ include
            LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.bin.$APPNAME"
            test -e "$LOCAL_APP_PROFILE" || {
                tmp=`mktemp`
                cat <<EOM > "$tmp"
# Site-specific additions and overrides for usr.bin.firefox.
# For more details, please see /etc/apparmor.d/local/README.
EOM
                mkdir `dirname $LOCAL_APP_PROFILE` 2>/dev/null || true
                mv -f "$tmp" "$LOCAL_APP_PROFILE"
                chmod 644 "$LOCAL_APP_PROFILE"
            }

            # Add the addons include
            ADDONS_APP_PROFILE="/etc/apparmor.d/abstractions/ubuntu-browsers.d/$APPNAME"
            test -e "$ADDONS_APP_PROFILE" || {
                tmp=`mktemp`
                cat <<EOM > "$tmp"
# This file is updated by 'aa-update-browser' and may be overwritten on
# upgrades.
#
# For site-specific adjustments, please see /etc/apparmor.d/local/<binary>

#include <abstractions/ubuntu-browsers.d/plugins-common>
#include <abstractions/ubuntu-browsers.d/mailto>
#include <abstractions/ubuntu-browsers.d/multimedia>
#include <abstractions/ubuntu-browsers.d/productivity>
#include <abstractions/ubuntu-browsers.d/java>
#include <abstractions/ubuntu-browsers.d/kde>
#include <abstractions/ubuntu-browsers.d/text-editors>
#include <abstractions/ubuntu-browsers.d/ubuntu-integration>
#include <abstractions/ubuntu-browsers.d/user-files>
EOM
                mkdir -p `dirname $ADDONS_APP_PROFILE` 2>/dev/null || true
                mv -f "$tmp" "$ADDONS_APP_PROFILE"
                chmod 644 "$ADDONS_APP_PROFILE"
            }
        fi

        # Reload AppArmor profile
        DISABLE_APP_PROFILE="/etc/apparmor.d/disable/usr.bin.$APPNAME"
        if [ ! -f "$DISABLE_APP_PROFILE" ] && aa-status --enabled 2>/dev/null; then
            apparmor_parser -r -T -W "$APP_PROFILE" || true
        fi
    fi
    #
    # End AppArmor
    #
fi

echo "Please restart all running instances of $APPNAME, or you will experience problems."

if [ -d /var/run ] ; then
    touch /var/run/$APPNAME-restart-required
fi

#DEBHELPER#