]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
selinux: load_policy script fix
authordyoung@redhat.com <dyoung@redhat.com>
Thu, 30 May 2013 06:19:00 +0000 (14:19 +0800)
committerHarald Hoyer <harald@redhat.com>
Thu, 30 May 2013 06:28:11 +0000 (08:28 +0200)
chroot load_policy will use selinuxfs which should be mounted
in $NEWROOT/sys/fs/selinux for Fedora 19, but because there's
no $NEWROOT/sys/fs, so later process will fail.

Fixing this by bind mount /sys to $NEWROOT/sys.

Signed-off-by: Dave Young <dyoung@redhat.com>
modules.d/98selinux/selinux-loadpolicy.sh

index 7526265f705ee329a40d9f390bcc081df0898569..5dddfc259537445d5eaaf4cc7f9feea93926d1f9 100755 (executable)
@@ -24,7 +24,8 @@ rd_load_policy()
         local ret=0
         local out
         info "Loading SELinux policy"
-        # load_policy does mount /proc and /selinux in
+        mount -o bind /sys $NEWROOT/sys
+        # load_policy does mount /proc and /sys/fs/selinux in
         # libselinux,selinux_init_load_policy()
         if [ -x "$NEWROOT/sbin/load_policy" ]; then
             out=$(LANG=C chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
@@ -35,6 +36,8 @@ rd_load_policy()
             ret=$?
             info $out
         fi
+        umount $NEWROOT/sys/fs/selinux
+        umount $NEWROOT/sys
 
         if [ "$SELINUX" = "disabled" ]; then
             return 0;