5
# summary of how this script can be called:
7
# * <old-prerm> `upgrade' <new-version>
8
# * <new-prerm> `failed-upgrade' <old-version>
9
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
10
# * <deconfigured's-prerm> `deconfigure' `in-favour'
11
# <package-being-installed> <version> `removing'
12
# <conflicting-package> <version>
13
# for details, see http://www.debian.org/doc/debian-policy/ or
14
# the debian-policy package
18
remove|upgrade|deconfigure)
19
/etc/init.d/selinux cancel
20
if [ -e /usr/share/debconf/confmodule ]; then
21
. /usr/share/debconf/confmodule
22
db_get selinux/updategrub || true
23
if [ "x$RET" = xtrue ]; then
26
defopt_trim=`/bin/grep "^# defoptions" $grub | /bin/sed -r -e 's/# defoptions=(\s+)?//' -e 's/selinux=[01](\s+)?//' -e 's/apparmor.enabled=[01](\s+)?//' -e 's/enforcing=[01](\s+?)//' -e 's/\s+$//'`
27
/bin/cp "$grub" "$grub"~
30
/bin/sed -i -e "s/^# defoptions=.*$/# defoptions=$defopt_trim/" "$grub"
33
/bin/cp "$grub"~ "$grub"
34
echo >&2 "Error: Unable to replace defoptions in menu.lst; changes reverted.";
39
/usr/bin/dpkg-trigger update-grub
40
db_input critical selinux/reboot || true
42
db_input critical selinux/uninstall || true
52
echo "prerm called with unknown argument \`$1'" >&2
57
# dh_installdeb will replace this with shell code automatically
58
# generated by other debhelper scripts.