talos/hack/imager.sh
Andrey Smirnov b037096202
feat: build Talos images with system extensions included
This allows to build a custom Talos image which comes with some system
extension bundled in. Sometimes we might need to have an extension in
the initial image, e.g. `vmtoolsd` for VMWare Talos image.

Syntax:

```
make image-aws \
  IMAGER_SYSTEM_EXTENSIONS="ghcr.io/siderolabs/amd-ucode:..."
```

System extensions are not supported for now for ISO images, as they
don't go through the common installer flow (#5725).

Also it might be nice to add a simple way to generate just
`initramfs.xz` with system extensions bundled in (e.g. for PXE booting).
(#5726)

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-06-10 00:10:22 +04:00

20 lines
541 B
Bash

# helper scripts for running imager functions
prepare_extension_images() {
# first argument - image platform, e.g. linux/amd64
# other arguments - list of system extension images
local platform="$1"
shift
local extensions_dir=$(mktemp -d)
for ext_image in "$@"; do
echo "Extracting ${ext_image}..." >&2
local ext_dir="${extensions_dir}/$(basename `mktemp -u`)"
mkdir -p "${ext_dir}" && \
crane export --platform="${platform}" "${ext_image}" - | tar x -C "${ext_dir}"
done
echo "${extensions_dir}"
}