From 1967692c6de26826fbde5fe86f244f18e4ec7333 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Jan 24 2025 11:48:08 +0000 Subject: common: Add kernel-install integration config Should be kept in sync with [1] until we can rebase on the bootc manifests/images. [1] https://gitlab.com/fedora/bootc/base-images/-/blob/main/tier-0/kernel-install.yaml See: https://gitlab.com/fedora/bootc/base-images/-/merge_requests/62 See: https://github.com/coreos/rpm-ostree/pull/5135 --- diff --git a/common.yaml b/common.yaml index 13a56c1..2793a11 100644 --- a/common.yaml +++ b/common.yaml @@ -15,6 +15,8 @@ include: - initramfs.yaml # Read only sysroot - sysroot-ro.yaml + # Enable kernel-install support + - kernel-install.yaml # systemd-pcrphase module fails on ppc64le: # https://gitlab.com/fedora/ostree/sig/-/issues/44 diff --git a/kernel-install.yaml b/kernel-install.yaml new file mode 100644 index 0000000..e8e9f37 --- /dev/null +++ b/kernel-install.yaml @@ -0,0 +1,25 @@ +# Configuration to enable kernel-install integration +# Keep in sync with https://gitlab.com/fedora/bootc/base-images/-/blob/main/tier-0/kernel-install.yaml +postprocess: + - | + #!/usr/bin/env bash + set -xeuo pipefail + source /usr/lib/os-release + # Check if the ID is Fedora and VERSION_ID is 42 or higher + if [[ "$ID" == "fedora" && "$VERSION_ID" -ge 42 ]]; then + echo -e "# kernel-install will not try to run dracut and allow rpm-ostree to\n\ + # take over. Rpm-ostree will use this to know that it is responsible\n\ + # to run dracut and ensure that there is only one kernel in the image\n\ + layout=ostree" | tee /usr/lib/kernel/install.conf > /dev/null + fi + # By default dnf keeps multiple versions of the kernel, with this + # configuration we tell dnf to treat the kernel as everything else. + # https://dnf.readthedocs.io/en/latest/conf_ref.html#main-options + # Let's add the config to a distribution configuration file if dnf5 + # is used, we append to /etc/dnf/dnf.conf if not. + if [ -d "/usr/share/dnf5/libdnf.conf.d/" ]; then + echo -e "[main]\ninstallonlypkgs=''" >> /usr/share/dnf5/libdnf.conf.d/20-ostree-installonlypkgs.conf + else + echo "installonlypkgs=''" >> /etc/dnf/dnf.conf + fi +