diff --git a/imgcreate/creator.py b/imgcreate/creator.py index 692d287..bb68111 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -493,12 +493,14 @@ class ImageCreator(object): # label the fs like it is a root before the bind mounting arglist = ["setfiles", "-F", "-r", self._instroot, selinux.selinux_file_context_path(), self._instroot] + logging.info("Executing: %s" % " ".join(arglist)) subprocess.call(arglist, close_fds = True) # these dumb things don't get magically fixed, so make the user generic # if selinux exists on the host we need to lie to the chroot if selinux.is_selinux_enabled(): for f in ("/proc", "/sys"): arglist = ["chcon", "-u", "system_u", self._instroot + f] + logging.info("Executing: %s" % " ".join(arglist)) subprocess.call(arglist, close_fds = True) def __destroy_selinuxfs(self): diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py index 62396b3..9ae55b7 100644 --- a/imgcreate/kickstart.py +++ b/imgcreate/kickstart.py @@ -479,10 +479,11 @@ 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) + arglist = ['setfiles', '-p', '-e', '/proc', + '-e', '/sys', '-e', '/dev', + selinux.selinux_file_context_path(), '/'] + logging.info('Executing: %s' % " ".join(arglist)) + rc = subprocess.call(arglist, preexec_fn=self.chroot) except OSError as e: if e.errno == errno.ENOENT: logging.info('The setfiles command is not available.')