From: Daan De Meyer Date: Wed, 9 Oct 2024 11:51:51 +0000 (+0200) Subject: Run various cleanup operations without the base trees mounted X-Git-Tag: v25~227^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6d858b2854edbc950646ca682dec7f48569b138;p=thirdparty%2Fmkosi.git Run various cleanup operations without the base trees mounted 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. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 28bc11845..5aafbb797 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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") diff --git a/mkosi/installer/__init__.py b/mkosi/installer/__init__.py index 1b331d004..832f11f22 100644 --- a/mkosi/installer/__init__.py +++ b/mkosi/installer/__init__.py @@ -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