summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-05-01 17:04:23 -0400
committerChris Lumens <clumens@redhat.com>2009-05-01 17:04:23 -0400
commit0ac21efe8043e7d135703381361beb6e8a5f7cff (patch)
treefdb4fc19e6e0ca3858739ea8b48cf136062db48d
parentedc7880e6018c7c54670a578e4ca3ddf59d53455 (diff)
downloadanaconda-0ac21efe8043e7d135703381361beb6e8a5f7cff.tar.gz
anaconda-0ac21efe8043e7d135703381361beb6e8a5f7cff.tar.xz
anaconda-0ac21efe8043e7d135703381361beb6e8a5f7cff.zip
Correct setting the SELinux context on mountpoints (#494995).
We need to pass the mountpoint and the chroot in separately so everything doesn't end up under /mnt/sysimage. Doing that results in the contexts being set to mnt_t, which causes all sorts of problems on reboot.
-rw-r--r--storage/formats/fs.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 93fa94811..177b43fd5 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -499,19 +499,19 @@ class FS(DeviceFormat):
# os.path.join("/mnt/foo", "/") -> "/"
#
#mountpoint = os.path.join(chroot, mountpoint)
- mountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
- iutil.mkdirChain(mountpoint)
+ chrootedMountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
+ iutil.mkdirChain(chrootedMountpoint)
if flags.selinux:
- ret = isys.resetFileContext(mountpoint)
+ ret = isys.resetFileContext(mountpoint, chroot)
log.info("set SELinux context for mountpoint %s to %s" \
% (mountpoint, ret))
# passed in options override default options
if not options or not isinstance(options, str):
options = self.options
-
+
try:
- rc = isys.mount(self.device, mountpoint,
+ rc = isys.mount(self.device, chrootedMountpoint,
fstype=self.mountType,
options=options,
bindMount=isinstance(self, BindFS))
@@ -522,15 +522,15 @@ class FS(DeviceFormat):
raise FSError("mount failed: %s" % rc)
if flags.selinux:
- ret = isys.resetFileContext(mountpoint)
+ ret = isys.resetFileContext(mountpoint, chroot)
log.info("set SELinux context for newly mounted filesystem "
"root at %s to %s" %(mountpoint, ret))
if self.lostAndFoundContext is None:
self.lostAndFoundContext = isys.matchPathContext("/lost+found")
isys.setFileContext("%s/lost+found" % mountpoint,
- self.lostAndFoundContext)
+ self.lostAndFoundContext, chroot)
- self._mountpoint = mountpoint
+ self._mountpoint = chrootedMountpoint
def unmount(self):
""" Unmount this filesystem. """