]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi: when done, dig out all holes (unless we compress anyway) 830/head
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Oct 2021 10:40:13 +0000 (12:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 8 Oct 2021 10:40:13 +0000 (12:40 +0200)
We likely have some NUL bytes in the image, let's explicitly seek them
out and punch holes into them.

mkosi/__init__.py

index fb30e7befc49a51952d647430e40fa5ed8b3bc24..9dec8eaa444fee835699a5f62edc63defb20bfa3 100644 (file)
@@ -3942,11 +3942,16 @@ def extract_unified_kernel(
 def compress_output(
     args: CommandLineArguments, data: Optional[BinaryIO], suffix: Optional[str] = None
 ) -> Optional[BinaryIO]:
+
     if data is None:
         return None
     compress = should_compress_output(args)
 
     if not compress:
+        # If we shan't compress, then at least make the output file sparse
+        with complete_step(f"Digging holes into output file {data.name}…"):
+            run(["fallocate", "--dig-holes", data.name])
+
         return data
 
     with complete_step(f"Compressing output file {data.name}…"):