]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Run various cleanup operations without the base trees mounted
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 9 Oct 2024 11:51:51 +0000 (13:51 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 9 Oct 2024 13:20:18 +0000 (15:20 +0200)
When running cleanup operations just before we finish the build and
we're building with Overlay=yes, we only want the cleanup to apply
to the overlay, not the base trees, so it makes sense to run the
final cleanup operations and the finalize scripts without the base
trees mounted.

This makes using chroot finalize scripts for overlay images impossible
but this shouldn't be a huge issue.

Package removals and selinux relabelling still run with the base trees
mounted because those operations rely on various files included in the
base trees.

mkosi/__init__.py
mkosi/installer/__init__.py

index 28bc118456b56152a18338ecca90aebaf404c29d..5aafbb7979d4eba5cf827c2de920c9f81972f033 100644 (file)
@@ -3572,10 +3572,11 @@ def build_image(context: Context) -> None:
         if manifest:
             manifest.record_packages()
 
-        clean_package_manager_metadata(context)
-        remove_files(context)
         run_selinux_relabel(context)
-        run_finalize_scripts(context)
+
+    clean_package_manager_metadata(context)
+    remove_files(context)
+    run_finalize_scripts(context)
 
     normalize_mtime(context.root, context.config.source_date_epoch)
     partitions = make_disk(context, skip=("esp", "xbootldr"), tabs=True, msg="Generating disk image")
index 1b331d00408016135d657eed6b8f427d7d30af86..832f11f229b3fad2e3d1e826d0d1a53bd0bfab9a 100644 (file)
@@ -164,9 +164,6 @@ def clean_package_manager_metadata(context: Context) -> None:
     """
     subdir = context.config.distribution.package_manager(context.config).subdir(context.config)
 
-    if context.config.overlay:
-        return
-
     if context.config.clean_package_metadata == ConfigFeature.disabled:
         return