diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 8400ae709..89aa88188 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -345,6 +345,7 @@ run_d_in_target pre-install run_d_in_target install do_extra_package_install run_d_in_target post-install +run_d post-root # ensure we do not have a lost+found directory in the root folder # that could cause copy to fail (it will be created again later # when creating the file system, if it needs such directory) diff --git a/doc/source/developer/developing_elements.rst b/doc/source/developer/developing_elements.rst index d37bc09c1..342bbb721 100644 --- a/doc/source/developer/developing_elements.rst +++ b/doc/source/developer/developing_elements.rst @@ -69,7 +69,9 @@ The phases are: #. ``pre-install.d`` #. ``install.d`` #. ``post-install.d`` +#. ``post-root.d`` #. ``block-device.d`` +#. ``pre-finalise.d`` #. ``finalise.d`` #. ``cleanup.d`` @@ -124,6 +126,13 @@ The phases are: * runs: **in chroot** +``post-root.d`` + Run code outside the chroot. This is a good place to perform tasks that + cannot run inside the chroot and must run after installing things. The + root filesystem content is rooted at ``$TMP_BUILD_DIR/mnt``. + + * runs: **outside chroot** + ``block-device.d`` Customise the block device that the image will be made on (for example to make partitions). Runs after the target tree has been fully populated but diff --git a/releasenotes/notes/post-root-stage-51da051bcdfbc55f.yaml b/releasenotes/notes/post-root-stage-51da051bcdfbc55f.yaml new file mode 100644 index 000000000..c4f8b3d8e --- /dev/null +++ b/releasenotes/notes/post-root-stage-51da051bcdfbc55f.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + A ``post-root`` stage is added that runs outside the chroot and + before the image size calculation. For example, this may be useful + for running things that copy much data into the image and need to be + outside of the chroot and after install stages which run inside the chroot.