livecd-tools/0001-Add-ability-to-prevent-SELinux-relabelling-from-host.patch
Mikhail Novosyolov 79087b8e10 Update patch
2020-05-17 16:04:26 +03:00

41 lines
1.5 KiB
Diff

From 9cce73578ee230bba3c566a2d9522ac51dfc815f Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Date: Sun, 17 May 2020 15:20:28 +0300
Subject: [PATCH] Add ability to prevent SELinux relabelling from host
https://github.com/livecd-tools/livecd-tools/issues/156
---
imgcreate/creator.py | 3 +++
imgcreate/kickstart.py | 2 ++
2 files changed, 5 insertions(+)
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 692d287..a6d7ef6 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -489,6 +489,9 @@ class ImageCreator(object):
self._instroot + self.__selinux_mountpoint + "/load"]
subprocess.call(arglist, close_fds = True)
+ if os.getenv("LIVECD_CREATOR_NO_SELINUX_LABELLING") is not None:
+ return
+
if force or kickstart.selinux_enabled(self.ks):
# label the fs like it is a root before the bind mounting
arglist = ["setfiles", "-F", "-r", self._instroot,
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index a7994b0..715faee 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -474,6 +474,8 @@ class SelinuxConfig(KickstartConfig):
if ksselinux.selinux == ksconstants.SELINUX_DISABLED:
return
+ if os.getenv("LIVECD_CREATOR_NO_SELINUX_LABELLING") is not None:
+ return
try:
rc = subprocess.call(['setfiles', '-p', '-e', '/proc',
--
2.25.1