Blame SOURCES/0158-v2v-linux-Use-new-SELinux_relabel-module-to-relabel-.patch

e76f14
From 98fff91388ecefeb7e2b9cb830b2e971b228be9d Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Wed, 13 Jul 2016 22:50:10 +0100
e76f14
Subject: [PATCH] v2v: linux: Use new SELinux_relabel module to relabel Linux
e76f14
 guests.
e76f14
e76f14
(cherry picked from commit fc114904848559e02d8f4e4a8bfb57277c349f0f)
e76f14
---
e76f14
 v2v/Makefile.am      |  1 +
e76f14
 v2v/convert_linux.ml | 10 ++--------
e76f14
 2 files changed, 3 insertions(+), 8 deletions(-)
e76f14
e76f14
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
e76f14
index 09a63a0..73a2d68 100644
e76f14
--- a/v2v/Makefile.am
e76f14
+++ b/v2v/Makefile.am
e76f14
@@ -149,6 +149,7 @@ BOBJECTS = \
e76f14
 	$(top_builddir)/mllib/curl.cmo \
e76f14
 	$(top_builddir)/customize/customize_utils.cmo \
e76f14
 	$(top_builddir)/customize/firstboot.cmo \
e76f14
+	$(top_builddir)/customize/SELinux_relabel.cmo \
e76f14
 	$(SOURCES_ML:.ml=.cmo)
e76f14
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
e76f14
 
e76f14
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
e76f14
index bdbd06b..825dae8 100644
e76f14
--- a/v2v/convert_linux.ml
e76f14
+++ b/v2v/convert_linux.ml
e76f14
@@ -406,13 +406,6 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source =
e76f14
 
e76f14
     | `Grub2 -> () (* Not necessary for grub2. *)
e76f14
 
e76f14
-  and autorelabel () =
e76f14
-    (* Only do autorelabel if load_policy binary exists.  Actually
e76f14
-     * loading the policy is problematic.
e76f14
-     *)
e76f14
-    if g#is_file ~followsymlinks:true "/usr/sbin/load_policy" then
e76f14
-      g#touch "/.autorelabel";
e76f14
-
e76f14
   and unconfigure_xen () =
e76f14
     (* Remove kmod-xenpv-* (RHEL 3). *)
e76f14
     let xenmods =
e76f14
@@ -1383,7 +1376,6 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source =
e76f14
   in
e76f14
 
e76f14
   augeas_grub_configuration ();
e76f14
-  autorelabel ();
e76f14
 
e76f14
   unconfigure_xen ();
e76f14
   unconfigure_vbox ();
e76f14
@@ -1409,6 +1401,8 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source =
e76f14
   configure_kernel_modules virtio;
e76f14
   rebuild_initrd kernel;
e76f14
 
e76f14
+  SELinux_relabel.relabel g;
e76f14
+
e76f14
   let guestcaps = {
e76f14
     gcaps_block_bus = if virtio then Virtio_blk else IDE;
e76f14
     gcaps_net_bus = if virtio then Virtio_net else E1000;
e76f14
-- 
aa0300
2.7.4
e76f14