Skip to content

Commit

Permalink
Run various cleanup operations without the base trees mounted
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DaanDeMeyer committed Oct 9, 2024
1 parent 77e13b3 commit f6d858b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 4 additions & 3 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 0 additions & 3 deletions mkosi/installer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f6d858b

Please sign in to comment.