Moving /selinux to /sys/fs/selinux to accomodate newer selinux in debian.
authorDaniel Baumann <mail@daniel-baumann.ch>
Wed, 16 Oct 2013 18:44:30 +0000 (20:44 +0200)
committerDaniel Baumann <mail@daniel-baumann.ch>
Wed, 16 Oct 2013 18:44:30 +0000 (20:44 +0200)
components/0100-selinux

index 4e0a4e6..4ec77fa 100755 (executable)
@@ -15,13 +15,23 @@ export DEBCONF_SYSTEMRC
 
 . /usr/share/debconf/confmodule
 
+if [ -e /selinux ]
+then
+       # squeeze
+       _SELINUXFS="/selinux"
+else
+       # wheezy and newer
+       _SELINUXFS="/sys/fs/selinux"
+fi
+
 Defaults ()
 {
        if [ -z "${_SELINUX_ENABLE}" ]
        then
-               if [ -n "$(cat /selinux/enforce 2> /dev/null)" ]
+
+               if [ -n "$(cat ${_SELINUXFS}/enforce 2> /dev/null)" ]
                then
-                       case "$(cat /selinux/enforce 2> /dev/null)" in
+                       case "$(cat ${_SELINUXFS}/enforce 2> /dev/null)" in
                                0)
                                        _SELINUX_ENABLE="false"
                                        ;;
@@ -57,13 +67,13 @@ db_stop
 
 case "${_SELINUX_ENABLE}" in
        true)
-               rm -f /selinux/enforce
-               rmdir --ignore-fail-on-non-empty /selinux > /dev/null 2>&1 || true
+               rm -f "${_SELINUXFS}/enforce"
+               rmdir --ignore-fail-on-non-empty "${_SELINUXFS}" > /dev/null 2>&1 || true
                ;;
 
        false)
-               mkdir -p /selinux
-               echo 0 > /selinux/enforce.tmp
-               mv /selinux/enforce.tmp /selinux/enforce
+               mkdir -p "${_SELINUXFS}"
+               echo 0 > "${_SELINUXFS}/enforce.tmp"
+               mv "${_SELINUXFS}/enforce.tmp" "${_SELINUXFS}/enforce"
                ;;
 esac