848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
1 |
#!/bin/sh
|
2 |
||
3 |
set -e
|
|
4 |
||
5 |
APP_DIR="/etc/apparmor.d" |
|
848.1.281
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_15_0b1_BUILD1) |
6 |
APP_PROFILE="usr.bin.@MOZ_PKG_NAME@" |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
7 |
APP_CONFFILE="$APP_DIR/$APP_PROFILE" |
8 |
APP_DISABLE="$APP_DIR/disable/$APP_PROFILE" |
|
848.1.281
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_15_0b1_BUILD1) |
9 |
MOZ_PKG_NAME=@MOZ_PKG_NAME@ |
10 |
MOZ_ADDONDIR=/@MOZ_ADDONDIR@ |
|
848.1.219
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_13_0b1_BUILD1) |
11 |
MOZ_LIBDIR=/@MOZ_LIBDIR@ |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
12 |
|
13 |
# Prepare to move a conffile without triggering a dpkg question
|
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
14 |
prepare_mv_conffile() { |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
15 |
local PKGNAME="$1" |
16 |
local CONFFILE="$2" |
|
17 |
||
18 |
[ -e "$CONFFILE" ] || return 0 |
|
19 |
||
20 |
local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" |
|
21 |
local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \ |
|
22 |
sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" |
|
23 |
#'
|
|
24 |
if [ "$md5sum" = "$old_md5sum" ]; then |
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
25 |
mv -f "$CONFFILE" "$CONFFILE.dpkg-remove" |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
26 |
fi
|
27 |
}
|
|
28 |
||
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
29 |
prepare_rm_conffile() { |
30 |
local PACKAGE="$1" |
|
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
31 |
local CONFFILE="$2" |
32 |
||
33 |
[ -e "$CONFFILE" ] || return 0 |
|
34 |
||
35 |
local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')" |
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
36 |
local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PACKAGE | \ |
37 |
sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" |
|
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
38 |
if [ "$md5sum" != "$old_md5sum" ]; then |
39 |
echo "Obsolete conffile $CONFFILE has been modified by you." |
|
40 |
echo "Saving as $CONFFILE.dpkg-bak ..." |
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
41 |
mv -f "$CONFFILE" "$CONFFILE.dpkg-backup" |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
42 |
else
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
43 |
echo "Moving obsolete conffile $CONFFILE out of the way..." |
44 |
mv -f "$CONFFILE" "$CONFFILE.dpkg-remove" |
|
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
45 |
fi
|
46 |
}
|
|
47 |
||
48 |
disable_profile() { |
|
49 |
# Create a symlink to the yet-to-be-unpacked profile
|
|
50 |
if [ ! -e "$APP_CONFFILE" ]; then |
|
51 |
mkdir -p `dirname $APP_DISABLE` 2>/dev/null || true |
|
52 |
ln -sf $APP_CONFFILE $APP_DISABLE |
|
53 |
fi
|
|
54 |
}
|
|
55 |
||
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
56 |
if [ "$1" = "install" ] || [ "$1" = "upgrade" ] ; then |
57 |
# Unconditionally disable AppArmor profile for Ubuntu 9.04 and under, since
|
|
58 |
# it requires abstractions found only in 9.10 and higher.
|
|
59 |
major=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1` |
|
60 |
version=`lsb_release -r | awk '{print $2}'` |
|
61 |
if [ "$major" -lt 10 ] && [ "$version" != "9.10" ]; then |
|
62 |
disable_profile |
|
63 |
else
|
|
64 |
if [ "$1" = "install" ]; then |
|
65 |
# Disable AppArmor profile on install, unless the last profile they
|
|
66 |
# modified is enabled.
|
|
67 |
base=`echo $APP_PROFILE | cut -d '-' -f 1` |
|
68 |
last_modified=`ls -rt $APP_DIR/$base* 2>/dev/null | grep -v '\.dpkg' | tail -n1` |
|
69 |
if [ -s "$last_modified" ]; then |
|
70 |
if [ -e "$APP_DIR/disable/`basename $last_modified`" ]; then |
|
71 |
disable_profile |
|
72 |
fi
|
|
73 |
else
|
|
74 |
# Fresh install and no other firefox profiles exist, so disable.
|
|
75 |
disable_profile |
|
76 |
fi
|
|
77 |
elif [ "$1" = "upgrade" ]; then |
|
78 |
# Disable AppArmor on upgrade from earlier than when we first shipped
|
|
79 |
# the profile if the user does not already have a profile defined.
|
|
80 |
if dpkg --compare-versions "$2" lt "3.7~a1~hg20091203" ; then |
|
81 |
disable_profile |
|
82 |
fi
|
|
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
83 |
fi
|
84 |
fi
|
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
85 |
|
848.1.281
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_15_0b1_BUILD1) |
86 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/bookmarks.html" |
87 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/localstore.rdf" |
|
88 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/mimeTypes.rdf" |
|
89 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/prefs.js" |
|
90 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/chrome/userChrome-example.css" |
|
91 |
prepare_rm_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/profile/chrome/userContent-example.css" |
|
848.1.139
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_10_0b1_BUILD1) |
92 |
|
848.1.281
by Chris Coulson
* New upstream release from the beta channel (FIREFOX_15_0b1_BUILD1) |
93 |
prepare_mv_conffile "${MOZ_PKG_NAME}" "/etc/${MOZ_PKG_NAME}/pref/firefox.js" |
848.1.85
by Chris Coulson
Grrrr, hate bzr. The file-ids need to match aurora, else the 2 branches are completely unmergeable. Goodbye history |
94 |
fi
|
95 |
||
96 |
#DEBHELPER#
|
|
97 |