selinux-loadpolicy: do not mount /proc and /selinux
authorHarald Hoyer <harald@redhat.com>
Wed, 9 Sep 2009 15:06:21 +0000 (17:06 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 9 Sep 2009 15:06:21 +0000 (17:06 +0200)
load_policy already does these things for us

modules.d/99base/selinux-loadpolicy.sh

index 84b3657..eaaf337 100755 (executable)
@@ -4,19 +4,20 @@
 if [ -x "$NEWROOT/usr/sbin/load_policy" -o -x "$NEWROOT/sbin/load_policy" ] && [ -e "$NEWROOT/etc/sysconfig/selinux" ]; then
     info "Loading SELinux policy"
     {
-    # load_policy does mount /proc and /selinux in libselinux,selinux_init_load_policy()
+        # load_policy does mount /proc and /selinux in libselinux,selinux_init_load_policy()
+        if [ -x "$NEWROOT/sbin/load_policy" ]; then
+            chroot "$NEWROOT" /sbin/load_policy -i
+            ret=$?
+        else
+            chroot "$NEWROOT" /usr/sbin/load_policy -i
+            ret=$?
+        fi
+    } 2>&1 | vinfo
 
-    if [ -x "$NEWROOT/sbin/load_policy" ]; then
-        chroot "$NEWROOT" /sbin/load_policy -i 2>&1
-    else
-        chroot "$NEWROOT" /usr/sbin/load_policy -i 2>&1
-    fi
-
-    if [ $? -eq 3 ]; then
+    if [ $ret -eq 3 ]; then
        warn "Initial SELinux policy load failed and enforcing mode requested."
        warn "Not continuing"
        sleep 100d
        exit 1
     fi
-    } | vinfo
 fi