Skip to content

Commit fc09d06

Browse files
committed
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>
1 parent d68245d commit fc09d06

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

Makefile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ install:
6767
if [ "$$ID" = "fedora" ] || [[ "$$ID_LIKE" == *"fedora"* ]]; then \
6868
install -D -m 0755 -t $(DESTDIR)/$(prefix)/lib/bootc contrib/scripts/fedora-bootc-destructive-cleanup; \
6969
fi
70+
install -D -m 0644 -t $(DESTDIR)/usr/lib/systemd/system crates/initramfs/*.service
71+
install -D -m 0755 target/release/bootc-initramfs-setup $(DESTDIR)/usr/lib/bootc/initramfs-setup
72+
install -D -m 0755 -t $(DESTDIR)/usr/lib/dracut/modules.d/51bootc crates/initramfs/dracut/module-setup.sh
7073

7174
# Run this to also take over the functionality of `ostree container` for example.
7275
# Only needed for OS/distros that have callers invoking `ostree container` and not bootc.
@@ -76,16 +79,6 @@ install-ostree-hooks:
7679
ln -sf ../../../bin/bootc $(DESTDIR)$(prefix)/libexec/libostree/ext/$$x; \
7780
done
7881

79-
# Install code in the initramfs, off by default except in builds from git main right now
80-
# Also the systemd unit hardcodes /usr so we give up the farce of supporting $(prefix)
81-
install-initramfs:
82-
install -D -m 0644 -t $(DESTDIR)/usr/lib/systemd/system crates/initramfs/*.service
83-
install -D -m 0755 target/release/bootc-initramfs-setup $(DESTDIR)/usr/lib/bootc/initramfs-setup
84-
85-
# Install initramfs files, including dracut module
86-
install-initramfs-dracut: install-initramfs
87-
install -D -m 0755 -t $(DESTDIR)/usr/lib/dracut/modules.d/51bootc crates/initramfs/dracut/module-setup.sh
88-
8982
# Install the main binary, the ostree hooks, and the integration test suite.
9083
install-all: install install-ostree-hooks
9184
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests

baseimage/dracut/usr/lib/dracut.conf.d/10-bootc-base.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# (really hostonly=no should be the default if dracut detects that
44
# it's in a container or so)
55
hostonly=no
6-
# We require ostree in the initramfs
7-
add_dracutmodules+=" ostree "
6+
# We require ostree and our own module in the initramfs
7+
add_dracutmodules+=" ostree bootc "

contrib/packaging/bootc.spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export SYSTEM_REINSTALL_BOOTC_INSTALL_PODMAN_PATH=%{system_reinstall_bootc_insta
125125
# Container build: use cargo directly with cached dependencies
126126
export CARGO_HOME=/var/roothome/.cargo
127127
cargo build -j%{_smp_build_ncpus} --release %{?with_rhsm:--features rhsm} \
128-
--bin=bootc --bin=system-reinstall-bootc \
128+
--bin=bootc --bin=system-reinstall-bootc --bin=bootc-initramfs-setup \
129129
%{?with_tests:--bin tests-integration}
130130
make manpages
131131
%else
@@ -200,6 +200,7 @@ fi
200200
%{_bindir}/bootc
201201
%{_prefix}/lib/bootc/
202202
%{_prefix}/lib/systemd/system-generators/*
203+
%{_prefix}/lib/dracut/modules.d/51bootc/
203204
%if %{with ostree_ext}
204205
%{_prefix}/libexec/libostree/ext/*
205206
%endif

contrib/packaging/install-rpm-and-setup

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ rpm -Uvh --oldpackage "${RPM_DIR}"/*.rpm
1010
rm -f "${RPM_DIR}"/*.rpm
1111

1212
# Regenerate initramfs if we have initramfs-setup
13-
if [ -x /usr/lib/bootc/initramfs-setup ]; then
14-
kver=$(cd /usr/lib/modules && echo *)
15-
env DRACUT_NO_XATTR=1 dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
16-
fi
13+
kver=$(cd /usr/lib/modules && echo *)
14+
# DRACUT_NO_XATTR=1 is the default in newer base images, and
15+
# we have --add bootc here until the change to add the module in base
16+
# images lands.
17+
env DRACUT_NO_XATTR=1 dracut --add bootc -vf /usr/lib/modules/$kver/initramfs.img $kver
1718

1819
# Only in this containerfile, inject a file which signifies
1920
# this comes from this development image. This can be used in

crates/initramfs/dracut/module-setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ installkernel() {
33
instmods erofs overlay
44
}
55
check() {
6-
require_binaries /usr/lib/bootc/initramfs-setup || return 1
6+
# We are never installed by default; see 10-bootc-base.conf
7+
# for how base images can opt in.
8+
return 255
79
}
810
depends() {
911
return 0

0 commit comments

Comments
 (0)