~yolanda.robla/ubuntu/saucy/clamav/dep-8-tests

52 by Jamie Strandboge
* Follow ApparmorProfileMigration and force apparmor complain mode on some
1
#! /bin/sh
2
# preinst script for #PACKAGE#
3
#
4
5
set -e
6
7
APP_PROFILE="usr.bin.freshclam"
8
APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE"
9
APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE"
10
if [ "$1" = "upgrade" ]; then
11
    mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true
12
    if dpkg --compare-versions $2 lt 0.92.1~dfsg2-1.1~feisty3 ; then
13
        # force-complain for pre-apparmor upgrades
14
        ln -sf $APP_CONFFILE $APP_COMPLAIN
15
    elif dpkg --compare-versions $2 lt 0.93.3.dfsg-1ubuntu1 ; then
16
        if [ -e "$APP_CONFFILE" ]; then
17
            md5sum="`md5sum \"$APP_CONFFILE\" | sed -e \"s/ .*//\"`"
18
            pkg_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $APP_CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
19
            if [ "$md5sum" = "$pkg_md5sum" ]; then
20
                # force-complain on upgrade from pre-shipped profile and
21
                # existing profile is same as in conffiles
22
                ln -sf $APP_CONFFILE $APP_COMPLAIN
23
            fi
24
        else
25
            # force-complain on upgrade from pre-shipped profile and
26
            # there is no existing profile
27
            ln -sf $APP_CONFFILE $APP_COMPLAIN
28
        fi
29
    fi
30
fi
31
32
#DEBHELPER#
33
34
exit 0
35