]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
selinux: fixed error handling for load-policy
authorHarald Hoyer <harald@redhat.com>
Wed, 21 Jul 2010 11:44:03 +0000 (13:44 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 21 Jul 2010 11:44:03 +0000 (13:44 +0200)
{} | cmd opens a subshell for {}

modules.d/98selinux/selinux-loadpolicy.sh

index 7db9f8cd80c9b65ae672e93ab0be0953a7472244..995999395b6a10731d0fa29ecca84e99c213ac4b 100755 (executable)
@@ -18,19 +18,20 @@ rd_load_policy()
 
     # Attempt to load SELinux Policy
     if [ -x "$NEWROOT/usr/sbin/load_policy" -o -x "$NEWROOT/sbin/load_policy" ]; then
-       ret=0
+       local ret=0
+       local out
        info "Loading SELinux 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
+        # load_policy does mount /proc and /selinux in 
+        # libselinux,selinux_init_load_policy()
+        if [ -x "$NEWROOT/sbin/load_policy" ]; then
+            out=$(chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
+            ret=$?
+           info $out
+        else
+           out=$(chroot "$NEWROOT" /usr/sbin/load_policy -i 2>&1)
+           ret=$?
+           info $out
+        fi
 
        if [ "$SELINUX" = "disabled" ]; then
            return 0;