From 5db8342a8b9e8917e7f7d575ec7bb305cd0cbc2d Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Sat, 19 Jan 2019 10:11:27 +0100 Subject: [PATCH] Add setfiles debug info for SELinux relabel Signed-off-by: David Abdurachmanov --- debug-setfiles.patch | 28 ++++++++++++++++++++++++++++ livecd-tools.spec | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 debug-setfiles.patch diff --git a/debug-setfiles.patch b/debug-setfiles.patch new file mode 100644 index 0000000..dd54109 --- /dev/null +++ b/debug-setfiles.patch @@ -0,0 +1,28 @@ +diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py +index 32d26b2..94a31a1 100644 +--- a/imgcreate/kickstart.py ++++ b/imgcreate/kickstart.py +@@ -479,10 +479,19 @@ class SelinuxConfig(KickstartConfig): + return + + try: +- rc = subprocess.call(['setfiles', '-p', '-e', '/proc', +- '-e', '/sys', '-e', '/dev', +- selinux.selinux_file_context_path(), '/'], +- preexec_fn=self.chroot) ++ cmd = ['setfiles', '-p', '-e', '/proc', ++ '-e', '/sys', '-e', '/dev', ++ selinux.selinux_file_context_path(), '/'] ++ proc = subprocess.Popen(cmd, ++ preexec_fn=self.chroot, ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE) ++ outs, errs = proc.communicate() ++ rc = proc.returncode ++ logging.info("setfiles command: {0}".format(cmd)) ++ logging.info("setfiles returncode: {0}".format(rc)) ++ logging.info("setfiles stdout: {0}".format(outs)) ++ logging.info("setfiles stderr: {0}".format(errs)) + except OSError as e: + if e.errno == errno.ENOENT: + logging.info('The setfiles command is not available.') diff --git a/livecd-tools.spec b/livecd-tools.spec index e88d14b..a9146bd 100644 --- a/livecd-tools.spec +++ b/livecd-tools.spec @@ -17,12 +17,13 @@ Summary: Tools for building live CDs Name: livecd-tools Version: 26.1 -Release: 1%{?dist} +Release: 1.davidlt.0%{?dist} Epoch: 1 License: GPLv2 Group: System Environment/Base URL: https://github.com/livecd-tools/livecd-tools Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.gz +Patch0: debug-setfiles.patch %if %{with python2} BuildRequires: python2-devel