]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Turn root into a mountpoint 328/head
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 19 Feb 2019 21:59:31 +0000 (13:59 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 27 Feb 2019 20:49:35 +0000 (12:49 -0800)
By doing this we can safely rely on mount --recursive doing the right
thing.

mkosi

diff --git a/mkosi b/mkosi
index f554eb5f49da968b434f4d3bc7fc74bc4a6bbda2..5190f348068270299c0ce564dc00d0ac0af933c2 100755 (executable)
--- 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"))