oxidecomputer / helios

Helios: Or, a Vision in a Dream. A Fragment.
Mozilla Public License 2.0
371 stars 10 forks source link

image: allow extra packages to be installed via -F #156

Closed jclulow closed 6 months ago

jclulow commented 6 months ago

This small change builds on a new image-builder facility: the expansion of multi-valued features into lists like those used by the pkg_install and pkg_uninstall steps.

In particular, this allows an engineer to throw a handful of extra packages into an ad hoc image without needing to edit any templates; e.g.,

./helios-build experiment-image \
    -p helios-dev=https://pkg.oxide.computer/helios/2/dev/ \
    -P "$proto" \
    -B \
    -F optever=0.29 \
    -F nfs \
    -F ntp \
    -F extra_packages+=/ooce/editor/neovim \
    -F extra_packages+=/terminal/tmux \
    -N "$name" \
    -o "$OSDIR/$image"

Note that the two -F extra_packages+=... lines add two packages to the extra_packages feature, which then gets expanded into two entries in the array at the position where the ${@extra_packages} macro appears.

NB: This PR is stacked on top of #155.

Testing Notes

I have tested this both with the above command, and also with the much simpler invocation:

./helios-build experiment-image -p helios-dev=https://pkg.oxide.computer/helios/2/dev/ 

I confirmed in both cases that the packages showed up only when they were expected to show up.