[Libguestfs] [PATCH 2/2] customize: Allow --selinux-relabel flag to work on cross-architecture builds (RHBZ#1212807).

Richard W.M. Jones rjones at redhat.com
Fri May 15 09:08:10 UTC 2015


---
 customize/customize_run.ml | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 0f1d72a..cd4616c 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -338,15 +338,19 @@ exec >>%s 2>&1
 
   if ops.flags.selinux_relabel then (
     msg (f_"SELinux relabelling");
-    let cmd = sprintf "
-      if load_policy && fixfiles restore; then
-        rm -f /.autorelabel
-      else
-        touch /.autorelabel
-        echo '%s: SELinux relabelling failed, will relabel at boot instead.'
-      fi
-    " prog in
-    do_run ~display:"load_policy && fixfiles restore" cmd
+    if guest_arch_compatible then (
+      let cmd = sprintf "
+        if load_policy && fixfiles restore; then
+          rm -f /.autorelabel
+        else
+          touch /.autorelabel
+          echo '%s: SELinux relabelling failed, will relabel at boot instead.'
+        fi
+      " prog in
+      do_run ~display:"load_policy && fixfiles restore" cmd
+    ) else (
+      g#touch "/.autorelabel"
+    )
   );
 
   (* Clean up the log file:
-- 
2.3.1




More information about the Libguestfs mailing list