Skip to main content

max / alloy

2.7 KB · 67 lines History Blame Raw
1 # Builder image for the Alloy installer ISO.
2 #
3 # Derived FROM the Alloy image rather than from stock Fedora, so the live
4 # initramfs is built against exactly the kernel and modules that ship. A
5 # builder on its own base would produce an initramfs for a different kernel
6 # and fail at boot with no obvious cause.
7 #
8 # The extra packages live here instead of in the image itself because none
9 # of them belong on an installed machine: dracut-live drives a squashfs
10 # root, and xorriso only ever assembles ISOs.
11 ARG BASE=localhost/alloy:local
12 FROM ${BASE}
13
14 # dnf is only usable here because this stage is thrown away; the shipped
15 # image disables the third-party repos it layered from at build time, so
16 # nothing below reaches for them.
17 #
18 # The GRUB packages are the one architecture-specific part: Fedora names them
19 # for the EFI target, and the x64 pair does not exist on an aarch64 host. The
20 # builder is always native (it is derived FROM the Alloy image, so it carries
21 # that image's kernel), so `uname -m` is the right question to ask.
22 RUN case "$(uname -m)" in \
23 x86_64) GRUB_EFI="grub2-efi-x64 grub2-efi-x64-modules" ;; \
24 aarch64) GRUB_EFI="grub2-efi-aa64 grub2-efi-aa64-modules" ;; \
25 *) echo "no GRUB packages known for $(uname -m)" >&2; exit 1 ;; \
26 esac \
27 && dnf install -y \
28 dracut-live \
29 xorriso \
30 squashfs-tools \
31 $GRUB_EFI \
32 grub2-tools \
33 grub2-tools-extra \
34 dosfstools \
35 mtools \
36 rsync \
37 && dnf clean all
38
39 # Give dracut somewhere for /root to point.
40 #
41 # dracut preserves /root whenever it is a symlink, unconditionally and from
42 # its own main script rather than from any module or config file:
43 #
44 # dracut.sh:1949 [ -L /root ]
45 # dracut.sh:1950 inst_symlink /root
46 #
47 # In the bootc layout /root is a symlink to var/roothome, /var is populated
48 # at install time rather than in a container image, and so dracut-install
49 # resolved the link to /var/roothome, found nothing, and printed
50 # "ERROR: installing '/root'" followed by a FAILED line, on every single
51 # build. It was harmless — the initramfs was complete and the live boot
52 # worked — which is exactly the problem: a build whose normal output
53 # contains dracut[E] and ERROR teaches whoever reads it to skim past both,
54 # and the next real failure arrives in a log already full of them.
55 #
56 # One empty directory ends it. The cost is an empty /root in the live
57 # initramfs, which is where a root home belongs anyway. Fixed here in the
58 # builder rather than in the shipped image, because it is the builder's own
59 # filesystem dracut walks and the installed system already gets its
60 # /var/roothome from bootc.
61 RUN mkdir -p /var/roothome
62
63 COPY build/make-iso.sh /usr/local/bin/make-iso
64 RUN chmod +x /usr/local/bin/make-iso
65
66 ENTRYPOINT ["/usr/local/bin/make-iso"]
67