From ffa40722dd0c4c2147272c1048fb237a96a98f90 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 6 Aug 2014 09:11:55 -0700 Subject: [PATCH] livemedia-creator: Run setfiles after no-virt installation Depending on the environment that --no-virt is run inside the resulting filesystem may need to have the SELinux labels updates. Run setfiles on the new filesystem after the anaconda run has finished. eg. when run from inside mock the labels will be incorrect. --- src/sbin/livemedia-creator | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index e25d4222..0d703fc5 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -652,6 +652,16 @@ def novirt_install(opts, disk_img, disk_size, repo_url): log.info("Running anaconda.") try: execWithRedirect("anaconda", args, raise_err=True) + + # Make sure the new filesystem is correctly labeled + args = ["-e", "/proc", "-e", "/sys", "-e", "/dev", + "/etc/selinux/targeted/contexts/files/file_contexts", "/"] + if opts.make_iso or opts.make_fsimage or opts.make_tar: + execWithRedirect("setfiles", args, root=ROOT_PATH) + else: + with PartitionMount(disk_img) as img_mount: + if img_mount and img_mount.mount_dir: + execWithRedirect("setfiles", args, root=img_mount.mount_dir) except subprocess.CalledProcessError as e: log.error("Running anaconda failed: %s", e) raise InstallError("novirt_install failed")