Overlay step

The component parts of a rock are built in a sequence of five separate steps: pull, overlay, build, stage and prime.

The overlay step is specific to rocks and is configured with overlay parameters. To learn more about pull, build, stage and prime see Part properties

The overlay step provides the means to modify the base filesystem before the build step is applied. If overlay-packages is used, those packages will be installed first. overlay-script will run the provided script in this step. The location of the overlay is made available in the ${CRAFT_OVERLAY} environment variable. overlay can be used to specify which files will be migrated to the next steps, and when omitted its default value will be "*".

Overlay Parameters

A part has three parameters that can be used to adjust how the overlay step works: overlay-packages, overlay-script and overlay-filter. overlay-packages and overlay (the filter parameter) behave much the same way as the related parameters on the STAGE step. overlay-script likewise behaves similarly to override-stage, including having access to the craftctl command.

An example parts section with overlay parameters looks as follows:

    plugin: nil
      - ed
    overlay-script: |
      rm -f ${CRAFT_OVERLAY}/usr/bin/vi ${CRAFT_OVERLAY}/usr/bin/vim*
      rm -f ${CRAFT_OVERLAY}/usr/bin/emacs*
      rm -f ${CRAFT_OVERLAY}/bin/nano
      - bin
      - usr/bin

After running this part, the overlay layer (and the final package) will only contain ed as an editor, with vi/vim, emacs, and nano all having been removed.