mirror of
https://gitlab.com/fedora/bootc/base-images.git
synced 2026-08-29 12:32:40 +00:00
Write the layout=ostree configuration to both /usr/lib/kernel/install.conf and /usr/lib/kernel/install.conf.d/00-bootc-kernel-layout.conf for defense-in-depth. The drop-in ensures the setting persists when systemd-udev overwrites install.conf during upgrades, while having both paths maintains compatibility with any tooling that reads the original location. The original install.conf path can be removed after a release cycle of rpm-ostree, once all consumers are updated to use the drop-in and have rpm-ostree changes. Resolves: RHEL-128312 Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Joseph Marrero Corchado <jmarrero@redhat.com>
26 lines
1.4 KiB
YAML
26 lines
1.4 KiB
YAML
# Configuration to enable kernel-install integration
|
|
postprocess:
|
|
- |
|
|
#!/usr/bin/env bash
|
|
set -xeuo pipefail
|
|
source /usr/lib/os-release
|
|
mkdir -p /usr/lib/kernel/install.conf.d
|
|
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 /usr/lib/kernel/install.conf.d/00-bootc-kernel-layout.conf > /dev/null
|
|
# 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.
|
|
# Also set protect_running_kernel=False, dnf/yum pre-dates Containers and
|
|
# uses uname to protect the running kernel even on Container builds.
|
|
if [ -d "/usr/share/dnf5/libdnf.conf.d/" ]; then
|
|
echo -e "[main]\ninstallonlypkgs=''" >> /usr/share/dnf5/libdnf.conf.d/20-ostree-installonlypkgs.conf
|
|
echo -e "[main]\nprotect_running_kernel=False" >> /usr/share/dnf5/libdnf.conf.d/20-ostree-protect_running_kernel.conf
|
|
else
|
|
echo "installonlypkgs=''" >> /etc/dnf/dnf.conf
|
|
echo "protect_running_kernel=False" >> /etc/dnf/dnf.conf
|
|
fi
|
|
|