| 108 |
108 |
|
--add "dmsquash-live" \
|
| 109 |
109 |
|
--omit "ostree bootc" \
|
| 110 |
110 |
|
--add-drivers "squashfs loop overlay iso9660 sr_mod sd_mod usb_storage virtio_blk virtio_scsi virtio_pci" \
|
| 111 |
|
- |
"$WORK/iso/boot/initramfs.img"
|
|
111 |
+ |
"$WORK/iso/boot/initramfs.img" 2>&1 | tee "$WORK/dracut.log"
|
| 112 |
112 |
|
|
| 113 |
113 |
|
# dracut reports module failures on stderr and still exits 0, so a broken
|
| 114 |
114 |
|
# initramfs ships looking like a success. Check the result instead.
|
| 115 |
115 |
|
#
|
| 116 |
|
- |
# Expect one error from this that does not matter: dracut-install cannot
|
| 117 |
|
- |
# install `/root`, because in the bootc layout /root is a symlink to
|
| 118 |
|
- |
# var/roothome and nothing has mounted a var here. dracut carries on and
|
| 119 |
|
- |
# the initramfs is complete.
|
|
116 |
+ |
# This build used to print `ERROR: installing '/root'` and a FAILED line
|
|
117 |
+ |
# every time, harmlessly: /root is a symlink to var/roothome in the bootc
|
|
118 |
+ |
# layout and no var is populated in a container. The builder now creates
|
|
119 |
+ |
# /var/roothome (see build/Containerfile.iso), so that error is gone rather
|
|
120 |
+ |
# than tolerated, and this check can be the strict one it could not be
|
|
121 |
+ |
# while a known error was expected in normal output.
|
|
122 |
+ |
#
|
|
123 |
+ |
# One message is still allowlisted, by its exact text. dracut tests for
|
|
124 |
+ |
# /dev/log or a logger binary before it installs anything and warns when it
|
|
125 |
+ |
# finds neither; `--install logger` does not satisfy it, because the test
|
|
126 |
+ |
# runs first. It concerns logging from inside the initramfs and nothing
|
|
127 |
+ |
# else. Matching the whole sentence rather than a pattern keeps the
|
|
128 |
+ |
# allowance from widening into "errors mentioning logging are fine".
|
| 120 |
129 |
|
#
|
| 121 |
130 |
|
# grep -c rather than grep -q: grep -q exits at the first match, which
|
| 122 |
131 |
|
# SIGPIPEs lsinitrd, and under `set -o pipefail` that reads as a failed
|
| 123 |
132 |
|
# check on a perfectly good initramfs. It cost a build to work that out.
|
| 124 |
133 |
|
[ -s "$WORK/iso/boot/initramfs.img" ] || { echo "dracut produced no initramfs" >&2; exit 1; }
|
|
134 |
+ |
unexpected="$(grep -E 'dracut\[E\]|dracut-install: ERROR|FAILED' "$WORK/dracut.log" \
|
|
135 |
+ |
| grep -vF "No '/dev/log' or 'logger' included for syslog logging" || true)"
|
|
136 |
+ |
if [ -n "$unexpected" ]; then
|
|
137 |
+ |
echo "dracut reported errors this build does not expect:" >&2
|
|
138 |
+ |
printf '%s\n' "$unexpected" | sed 's/^/ /' >&2
|
|
139 |
+ |
exit 1
|
|
140 |
+ |
fi
|
| 125 |
141 |
|
found="$(lsinitrd "$WORK/iso/boot/initramfs.img" 2>/dev/null | grep -c dmsquash || true)"
|
| 126 |
142 |
|
[ "${found:-0}" -gt 0 ] \
|
| 127 |
143 |
|
|| { echo "initramfs has no dmsquash-live; it cannot mount the live root" >&2; exit 1; }
|