]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Make inserted root or /usr partition at least as big as RootSize
authorMichael A Cassaniti <michael@cassaniti.id.au>
Thu, 28 Jul 2022 12:02:09 +0000 (22:02 +1000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 26 Oct 2022 15:50:40 +0000 (17:50 +0200)
When using SquashFS in particular, the size of the partition inserted will
always be the size of the SquashFS image. This change allows the partition
size to be set which allows for future growth.

mkosi/__init__.py

index 760f7ffe2de3da51184bcb6d31e9fe941d06f0bb..6479d4c5f8fd5cf6777505ccf700b0c14b384afd 100644 (file)
@@ -3645,6 +3645,9 @@ def insert_partition(
 
     luks_extra = 16 * 1024 * 1024 if state.config.encrypt == "all" else 0
     blob_size = os.stat(blob.name).st_size
+    if ident == PartitionIdentifier.root and not state.config.minimize:
+        # Make root partition at least as big as the specified size
+        blob_size = max(blob_size, state.config.root_size)
     part = state.partition_table.add(ident, blob_size + luks_extra, type_uuid, description, part_uuid)
 
     disk_size = state.partition_table.disk_size()
@@ -6562,7 +6565,9 @@ def load_args(args: argparse.Namespace) -> MkosiConfig:
 
     if args.output_format.is_squashfs():
         args.read_only = True
-        args.root_size = None
+        if args.root_size is None:
+            # Size will be automatic
+            args.minimize = True
         if args.compress is False:
             die("Cannot disable compression with squashfs", MkosiNotSupportedException)
         if args.compress is None: