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

« back to all changes in this revision

Viewing changes to debian/clamav-daemon.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2008-09-18 22:06:59 UTC
  • Revision ID: james.westby@ubuntu.com-20080918220659-40n4cr9qt6yklpzm
Tags: 0.94.dfsg-1ubuntu1
* Follow ApparmorProfileMigration and force apparmor complain mode on some
  upgrades (LP: #264817)
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6 for
    clamav-daemon and clamav-freshclam
  - add debian/usr.bin.freshclam and debian/usr.sbin.clamd
  - debian/clamav-(daemon|freshclam).dirs: add etc/apparmor.d/force-complain
  - debian/clamav-(daemon|freshclam).install: install profiles
  - debian/clamav-(daemon|freshclam).preinst: create symlink for
    force-complain/ on pre-feisty upgrades, upgrades where apparmor-profiles
    profile is unchanged (ie non-enforcing) and upgrades where the profile
    doesn't exist.
  - debian/clamav-(daemon|freshclam).postrm: remove symlink in
    force-complain/ on purge.
  - debian/clamav-(daemon|freshclam).postinst.in: reload apparmor
  - update README.Debian with note on Apparmor

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# preinst script for #PACKAGE#
 
3
#
 
4
 
 
5
set -e
 
6
 
 
7
APP_PROFILE="usr.sbin.clamd"
 
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