From: Lucas De Marchi Date: Tue, 19 Feb 2019 21:59:31 +0000 (-0800) Subject: Turn root into a mountpoint X-Git-Tag: v5~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F328%2Fhead;p=thirdparty%2Fmkosi.git Turn root into a mountpoint By doing this we can safely rely on mount --recursive doing the right thing. --- 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"))