Add a pre-finalise.d phase

In exploring Gentoo caching, it was realised that we have no way to
bind mount the cache into the finalised image for the finalise.d
phases.

By adding a pre-finalise.d phase that runs outside the chroot, we can
mount outside things into the hierarchy at $TMP_BUILD_DIR/mnt which
are then seen by the in-chroot finalise.d phase.

This is similar to the pre-install phase

Change-Id: I9d782994843383ddf90f62c40498af9925fd9558
This commit is contained in:
Ian Wienand 2018-10-12 12:03:26 +11:00
parent ee156e8232
commit fadf99af05
3 changed files with 19 additions and 0 deletions

View File

@ -486,6 +486,7 @@ sudo cp -ra ${TMP_BUILD_DIR}/built/* $TMP_BUILD_DIR/mnt
sudo rm -fr ${TMP_BUILD_DIR}/built/* sudo rm -fr ${TMP_BUILD_DIR}/built/*
mount_proc_dev_sys mount_proc_dev_sys
run_d pre-finalise
run_d_in_target finalise run_d_in_target finalise
finalise_base finalise_base

View File

@ -137,6 +137,16 @@ The phases are:
* outputs: ``$IMAGE_BLOCK_DEVICE={path}`` * outputs: ``$IMAGE_BLOCK_DEVICE={path}``
``pre-finalise.d``
Final tuning of the root filesystem, outside the chroot. Filesystem
content has been copied into the final file system which is rooted
at ``$TMP_BUILD_DIR/mnt``. You might do things like re-mount a
cache directory that was used during the build in this phase (with
subsequent unmount in ``cleanup.d``).
* runs: **outside chroot**
``finalise.d`` ``finalise.d``
Perform final tuning of the root filesystem. Runs in a chroot after the root Perform final tuning of the root filesystem. Runs in a chroot after the root
filesystem content has been copied into the mounted filesystem: this is an filesystem content has been copied into the mounted filesystem: this is an

View File

@ -0,0 +1,8 @@
---
features:
- |
A ``pre-finalise`` stage is added that runs outside the chroot and
before the ``finalise`` stage. For example, this may be useful
for mounting external resources that are used inside the chroot
during the ``finalise`` stage, but do not need to be distributed
in the final image such as build-time caches.