meta-virtualization/conf/layer.conf
Bruce Ashfield 491a385ca6 config: introduce hostname generation hooks
Overriding hostname in a .conf file, via base-files:

  HOST_NAME="k3s-host"
  hostname_pn-base-files = "${HOST_NAME}"

Is always a valid option, but if it is not configured, we can easily
have two hosts with the same name on the network, confusing adddress
assignement, etc.

This commit introduces a way to generate a unique hostname based
on the uuid of the build host, and the machine being built.

If virt-unique-hostname is added to IMAGE_FEATURES, like the following:

  IMAGE_FEATURES += "virt-unique-hostname"
  IMAGE_FEATURES[validitems] += "virt-unique-hostname"

Then a rootfs postprocessing hook will override hostnae to something
unique.

Note: this means your image will be reproducible on a single builder,
but not between them.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
2021-12-13 15:59:35 -05:00

63 lines
2.3 KiB
Plaintext

# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
BBFILE_COLLECTIONS += "virtualization-layer"
BBFILE_PATTERN_virtualization-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_virtualization-layer = "8"
# Custom licenses used by some packages in this layer
LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
BBFILES_DYNAMIC += " \
raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bb \
raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bbappend \
xilinx:${LAYERDIR}/dynamic-layers/xilinx/*/*/*.bb \
xilinx:${LAYERDIR}/dynamic-layers/xilinx/*/*/*.bbappend \
"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_virtualization-layer = "1"
LAYERSERIES_COMPAT_virtualization-layer = "honister"
LAYERDEPENDS_virtualization-layer = " \
core \
openembedded-layer \
networking-layer \
filesystems-layer \
meta-python \
"
# webserver: naigos requires apache2
LAYERRECOMMENDS_virtualization-layer = " \
webserver \
selinux \
"
# Override security flags
require conf/distro/include/virt_security_flags.inc
PREFERRED_PROVIDER_virtual/runc ?= "runc-opencontainers"
PREFERRED_PROVIDER_virtual/containerd ?= "containerd-opencontainers"
PREFERRED_PROVIDER_virtual/docker ?= "docker-ce"
# Sanity check for meta-virtualization layer.
# Setting SKIP_META_VIRT_SANITY_CHECK to "1" would skip the bbappend files check.
INHERIT += "sanity-meta-virt"
# We need to load the meta-virt config components, only if "virtualization"
# is in the distro features. Since we don't know the distro flags during
# layer.conf load time, we delay using a special bbclass that simply includes
# the META_VIRT_CONFIG_PATH file, and likewise for the Xen and k8s configs
META_VIRT_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-default-versions.inc"
META_VIRT_XEN_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-xen.inc"
K8S_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/k8s-versions.inc"
USER_CLASSES:append = " meta-virt-cfg"
USER_CLASSES:append = " meta-virt-k8s-cfg"
USER_CLASSES:append = " meta-virt-xen-cfg"
USER_CLASSES:append = " meta-virt-hosts"
HOSTTOOLS_NONFATAL += "getent"