1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 06:45:13 +01:00

build-sys: Always install initramfs module

Now that we've cut over to always building + installing via
an (RPM) package in our build system, we need to always install
the dracut module.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters
2025-11-18 13:59:57 -05:00
parent d68245d319
commit fc09d06e73
5 changed files with 15 additions and 18 deletions

View File

@@ -67,6 +67,9 @@ install:
if [ "$$ID" = "fedora" ] || [[ "$$ID_LIKE" == *"fedora"* ]]; then \
install -D -m 0755 -t $(DESTDIR)/$(prefix)/lib/bootc contrib/scripts/fedora-bootc-destructive-cleanup; \
fi
install -D -m 0644 -t $(DESTDIR)/usr/lib/systemd/system crates/initramfs/*.service
install -D -m 0755 target/release/bootc-initramfs-setup $(DESTDIR)/usr/lib/bootc/initramfs-setup
install -D -m 0755 -t $(DESTDIR)/usr/lib/dracut/modules.d/51bootc crates/initramfs/dracut/module-setup.sh
# Run this to also take over the functionality of `ostree container` for example.
# Only needed for OS/distros that have callers invoking `ostree container` and not bootc.
@@ -76,16 +79,6 @@ install-ostree-hooks:
ln -sf ../../../bin/bootc $(DESTDIR)$(prefix)/libexec/libostree/ext/$$x; \
done
# Install code in the initramfs, off by default except in builds from git main right now
# Also the systemd unit hardcodes /usr so we give up the farce of supporting $(prefix)
install-initramfs:
install -D -m 0644 -t $(DESTDIR)/usr/lib/systemd/system crates/initramfs/*.service
install -D -m 0755 target/release/bootc-initramfs-setup $(DESTDIR)/usr/lib/bootc/initramfs-setup
# Install initramfs files, including dracut module
install-initramfs-dracut: install-initramfs
install -D -m 0755 -t $(DESTDIR)/usr/lib/dracut/modules.d/51bootc crates/initramfs/dracut/module-setup.sh
# Install the main binary, the ostree hooks, and the integration test suite.
install-all: install install-ostree-hooks
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests

View File

@@ -3,5 +3,5 @@
# (really hostonly=no should be the default if dracut detects that
# it's in a container or so)
hostonly=no
# We require ostree in the initramfs
add_dracutmodules+=" ostree "
# We require ostree and our own module in the initramfs
add_dracutmodules+=" ostree bootc "

View File

@@ -125,7 +125,7 @@ export SYSTEM_REINSTALL_BOOTC_INSTALL_PODMAN_PATH=%{system_reinstall_bootc_insta
# Container build: use cargo directly with cached dependencies
export CARGO_HOME=/var/roothome/.cargo
cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} \
--bin=bootc --bin=system-reinstall-bootc \
--bin=bootc --bin=system-reinstall-bootc --bin=bootc-initramfs-setup \
%{?with_tests:--bin tests-integration}
make manpages
%else
@@ -200,6 +200,7 @@ fi
%{_bindir}/bootc
%{_prefix}/lib/bootc/
%{_prefix}/lib/systemd/system-generators/*
%{_prefix}/lib/dracut/modules.d/51bootc/
%if %{with ostree_ext}
%{_prefix}/libexec/libostree/ext/*
%endif

View File

@@ -10,10 +10,11 @@ rpm -Uvh --oldpackage "${RPM_DIR}"/*.rpm
rm -f "${RPM_DIR}"/*.rpm
# Regenerate initramfs if we have initramfs-setup
if [ -x /usr/lib/bootc/initramfs-setup ]; then
kver=$(cd /usr/lib/modules && echo *)
env DRACUT_NO_XATTR=1 dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
fi
kver=$(cd /usr/lib/modules && echo *)
# DRACUT_NO_XATTR=1 is the default in newer base images, and
# we have --add bootc here until the change to add the module in base
# images lands.
env DRACUT_NO_XATTR=1 dracut --add bootc -vf /usr/lib/modules/$kver/initramfs.img $kver
# Only in this containerfile, inject a file which signifies
# this comes from this development image. This can be used in

View File

@@ -3,7 +3,9 @@ installkernel() {
instmods erofs overlay
}
check() {
require_binaries /usr/lib/bootc/initramfs-setup || return 1
# We are never installed by default; see 10-bootc-base.conf
# for how base images can opt in.
return 255
}
depends() {
return 0