diff --git a/bootstrapvz/common/task_groups.py b/bootstrapvz/common/task_groups.py index d4417e9..90bff08 100644 --- a/bootstrapvz/common/task_groups.py +++ b/bootstrapvz/common/task_groups.py @@ -74,6 +74,8 @@ boot_partition_group = [filesystem.CreateBootMountDir, mounting_group = [filesystem.CreateMountDir, filesystem.MountRoot, filesystem.MountSpecials, + filesystem.CopyMountTable, + filesystem.RemoveMountTable, filesystem.UnmountRoot, filesystem.DeleteMountDir, ] diff --git a/bootstrapvz/common/tasks/filesystem.py b/bootstrapvz/common/tasks/filesystem.py index a6cb782..19acbfe 100644 --- a/bootstrapvz/common/tasks/filesystem.py +++ b/bootstrapvz/common/tasks/filesystem.py @@ -115,6 +115,18 @@ class MountSpecials(Task): root.add_mount('none', 'dev/pts', ['--types', 'devpts']) +class CopyMountTable(Task): + description = 'Copying mtab from host system' + phase = phases.os_installation + predecessors = [MountSpecials] + + @classmethod + def run(cls, info): + import shutil + import os.path + shutil.copy('/proc/mounts', os.path.join(info.root, 'etc/mtab')) + + class UnmountRoot(Task): description = 'Unmounting the bootstrap volume' phase = phases.volume_unmounting @@ -125,6 +137,17 @@ class UnmountRoot(Task): info.volume.partition_map.root.unmount() +class RemoveMountTable(Task): + description = 'Removing mtab' + phase = phases.volume_unmounting + successors = [UnmountRoot] + + @classmethod + def run(cls, info): + import os + os.remove(os.path.join(info.root, 'etc/mtab')) + + class DeleteMountDir(Task): description = 'Deleting mountpoint for the bootstrap volume' phase = phases.volume_unmounting