~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

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
#! /bin/sh
# preinst script for #PACKAGE#
#

set -e

APP_PROFILE="usr.bin.freshclam"
APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE"
APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE"
if [ "$1" = "upgrade" ]; then
    mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true
    if dpkg --compare-versions $2 lt 0.92.1~dfsg2-1.1~feisty3 ; then
        # force-complain for pre-apparmor upgrades
        ln -sf $APP_CONFFILE $APP_COMPLAIN
    elif dpkg --compare-versions $2 lt 0.93.3.dfsg-1ubuntu1 ; then
        if [ -e "$APP_CONFFILE" ]; then
            md5sum="`md5sum \"$APP_CONFFILE\" | sed -e \"s/ .*//\"`"
            pkg_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $APP_CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
            if [ "$md5sum" = "$pkg_md5sum" ]; then
                # force-complain on upgrade from pre-shipped profile and
                # existing profile is same as in conffiles
                ln -sf $APP_CONFFILE $APP_COMPLAIN
            fi
        else
            # force-complain on upgrade from pre-shipped profile and
            # there is no existing profile
            ln -sf $APP_CONFFILE $APP_COMPLAIN
        fi
    fi
fi

#DEBHELPER#

exit 0