From 0a9928d5506fa94d866da4be64dc1bcf5f9d97d0 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 19 Feb 2019 13:59:31 -0800 Subject: [PATCH] Turn root into a mountpoint By doing this we can safely rely on mount --recursive doing the right thing. --- mkosi | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mkosi b/mkosi index f554eb5f4..5190f3480 100755 --- a/mkosi +++ b/mkosi @@ -917,16 +917,15 @@ def mount_image(args: CommandLineArguments, home_dev: Optional[str], srv_dev: Optional[str], root_read_only: bool = False) -> Generator[None, None, None]: - if loopdev is None: - yield None - return - assert root_dev is not None - with complete_step('Mounting image'): root = os.path.join(workspace, "root") - if args.output_format != OutputFormat.gpt_squashfs: + if root_dev is not None: mount_loop(args, root_dev, root, root_read_only) + else: + # always have a root of the tree as a mount point so we can + # recursively unmount anything that ends up mounted there + mount_bind(root, root) if home_dev is not None: mount_loop(args, home_dev, os.path.join(root, "home")) -- 2.47.2