mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From 63f9fefe9b4513d8a17e7594e5c87a0ab90593f9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 15 May 2015 10:03:42 +0100
Subject: [PATCH] customize: Allow --selinux-relabel flag to work on
 cross-architecture builds (RHBZ#1212807).

(cherry picked from commit a43e8405ef83786f72f507f1aea31977b2f4de91)
---
 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 6b861d5..48ae24b 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -307,15 +307,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:
-- 
1.8.3.1