Skip to content

Commit 635ca51

Browse files
fix(acl): harmonize UKI discovery error handling across cleanup and test
- cleanup-vhd.sh: fail loud (exit 1) when no UKI is found instead of silently no-op'ing. Previously the silent skip could ship a VHD without the firstboot addon -- the exact failure mode this PR set out to fix (no flatcar.first_boot=detected -> Ignition subsequent-boot -> oem- cloudinit skipped -> scriptless CSE 17-min hang). The fail-loud path stays ACL-scoped under the existing [ -f /boot/acl/uki-addons/ firstboot.addon.efi ] guard, so non-ACL distros are unaffected. - cleanup-vhd.sh: use basename(uki_path) for addon_dir so the variable shape matches tool_installs_acl.sh and linux-vhd-content-test.sh. - linux-vhd-content-test.sh: rename acl_uki_path/acl_uki_name/ acl_fips_addon to uki_path/uki_name/fips_addon_path for grep parity with the production install path. Capitalize "No UKI..." message to match the other two sites. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 23b9ea6 commit 635ca51

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

vhdbuilder/packer/cleanup-vhd.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ if [ -f /boot/acl/uki-addons/firstboot.addon.efi ]; then
2020
uki_path="$(find /boot/EFI/Linux -maxdepth 1 -type f \
2121
\( -name 'vmlinuz-*.efi' -o -name 'acl.efi' \) 2>/dev/null \
2222
| sort | head -n1)"
23-
if [ -n "${uki_path}" ]; then
24-
addon_dir="${uki_path}.extra.d"
25-
if [ ! -f "${addon_dir}/firstboot.addon.efi" ]; then
26-
install -D -m 0644 /boot/acl/uki-addons/firstboot.addon.efi "${addon_dir}/firstboot.addon.efi"
27-
fi
23+
if [ -z "${uki_path}" ]; then
24+
echo "cleanup-vhd: No UKI found under /boot/EFI/Linux (expected acl.efi or vmlinuz-*.efi); firstboot addon not restored" >&2
25+
exit 1
26+
fi
27+
uki_name="$(basename "${uki_path}")"
28+
addon_dir="/boot/EFI/Linux/${uki_name}.extra.d"
29+
if [ ! -f "${addon_dir}/firstboot.addon.efi" ]; then
30+
install -D -m 0644 /boot/acl/uki-addons/firstboot.addon.efi "${addon_dir}/firstboot.addon.efi"
2831
fi
2932
fi
3033
# Cleanup disk usage diagnostics file (created by generate-disk-usage.sh)

vhdbuilder/packer/test/linux-vhd-content-test.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,17 +646,17 @@ testFips() {
646646
# images use "vmlinuz-<version>.efi". systemd-boot loads cmdline addons
647647
# from "<UKI filename>.extra.d/", so the addon directory tracks the
648648
# UKI's actual name. Probe for either layout.
649-
acl_uki_path=$(find /boot/EFI/Linux -maxdepth 1 -type f \
649+
uki_path=$(find /boot/EFI/Linux -maxdepth 1 -type f \
650650
\( -name 'vmlinuz-*.efi' -o -name 'acl.efi' \) 2>/dev/null | sort | head -n1)
651-
if [ -z "${acl_uki_path}" ]; then
652-
err $test "no UKI found under /boot/EFI/Linux (expected acl.efi or vmlinuz-*.efi)."
651+
if [ -z "${uki_path}" ]; then
652+
err $test "No UKI found under /boot/EFI/Linux (expected acl.efi or vmlinuz-*.efi)."
653653
else
654-
acl_uki_name=$(basename "${acl_uki_path}")
655-
acl_fips_addon="/boot/EFI/Linux/${acl_uki_name}.extra.d/fips.addon.efi"
656-
if [ -f "${acl_fips_addon}" ]; then
657-
echo "ACL FIPS UKI addon file exists at ${acl_fips_addon}."
654+
uki_name=$(basename "${uki_path}")
655+
fips_addon_path="/boot/EFI/Linux/${uki_name}.extra.d/fips.addon.efi"
656+
if [ -f "${fips_addon_path}" ]; then
657+
echo "ACL FIPS UKI addon file exists at ${fips_addon_path}."
658658
else
659-
err $test "ACL FIPS UKI addon file does not exist at ${acl_fips_addon}."
659+
err $test "ACL FIPS UKI addon file does not exist at ${fips_addon_path}."
660660
fi
661661
fi
662662
fi

0 commit comments

Comments
 (0)