~ubuntu-branches/ubuntu/hardy/openldap2.3/hardy-updates

« back to all changes in this revision

Viewing changes to debian/slapd.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2008-03-18 13:53:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080318135323-d34z71cijxts6dt0
Tags: 2.4.7-6ubuntu2
* apparmor-profile workaround for Launchpad #202161 
* follow ApparmorProfileMigration and force apparmor complain mode on some
  upgrades (LP: #203529)
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - debian/slapd.preinst: create symlink for force-complain/ on pre-feisty
    upgrades, upgrades where apparmor-profiles profile is unchanged (ie
    non-enforcing) and upgrades where apparmor profile does not exist
  - debian/slapd.postrm: remove symlink in force-complain/ on purge
* debian/rules, debian/slapd.links: use hard links to slapd instead of
  symlinks for slap* so these applications aren't confined by apparmor
  (LP: #203898)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
        dump_databases
18
18
fi
19
19
 
 
20
APP_PROFILE="usr.sbin.slapd"
 
21
APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE"
 
22
APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE"
 
23
if [ "$1" = "upgrade" ]; then
 
24
    mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true
 
25
    if dpkg --compare-versions $2 lt 2.3.30-2 ; then
 
26
        # force-complain for pre-apparmor upgrades
 
27
        ln -sf $APP_CONFFILE $APP_COMPLAIN
 
28
    elif dpkg --compare-versions $2 lt 2.4.7-5ubuntu1 ; then
 
29
        if [ -e "$APP_CONFFILE" ]; then
 
30
            md5sum="`md5sum \"$APP_CONFFILE\" | sed -e \"s/ .*//\"`"
 
31
            pkg_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $APP_CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
 
32
            if [ "$md5sum" = "$pkg_md5sum" ]; then
 
33
                # force-complain on upgrade from pre-shipped profile and
 
34
                # existing profile is same as in conffiles
 
35
                ln -sf $APP_CONFFILE $APP_COMPLAIN
 
36
            fi
 
37
        else
 
38
            # force-complain on upgrade from pre-shipped profile and
 
39
            # there is no existing profile
 
40
            ln -sf $APP_CONFFILE $APP_COMPLAIN
 
41
        fi
 
42
    fi
 
43
fi
 
44
 
 
45
 
20
46
#DEBHELPER#
21
47
 
22
48
exit 0