2 # pre install script for the Debian bind9 package
6 # Check if we are upgrading while running a kernel before 2.2.18. If so abort
7 # immediately since we don't support those kernels anymore.
8 if [ "$1" = "upgrade" ] && dpkg --compare-versions "`uname -r`" lt 2.2.18 ; then
10 ERROR: you are running a pre-2.2.18 kernel on this machine. Recent
11 versions of bind9 no longer support those kernels.
12 To prevent breaking nameservices on this system bind9 upgrade will abort.
17 APP_PROFILE="usr.sbin.named"
18 APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE"
19 APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE"
20 if [ "$1" = "upgrade" ]; then
21 mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true
22 if dpkg --compare-versions $2 lt 1:9.3.4-2ubuntu2 ; then
23 # force-complain for pre-apparmor upgrades
24 ln -sf $APP_CONFFILE $APP_COMPLAIN
25 elif dpkg --compare-versions $2 lt 1:9.4.2-3ubuntu1 ; then
26 if [ -e "$APP_CONFFILE" ]; then
27 md5sum="`md5sum \"$APP_CONFFILE\" | sed -e \"s/ .*//\"`"
28 pkg_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $APP_CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
29 if [ "$md5sum" = "$pkg_md5sum" ]; then
30 # force-complain when upgrade from pre-shipped profile and an existing
31 # profile is same as in conffiles
32 ln -sf $APP_CONFFILE $APP_COMPLAIN
35 # force-complain on upgrade from pre-shipped profile and
36 # there is no existing profile
37 ln -sf $APP_CONFFILE $APP_COMPLAIN