From 504d860466a885343f11a59ff32e9cf36166edfb Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Wed, 23 Mar 2022 17:23:59 -0400 Subject: [PATCH] Backport "blockdev: rework EFI vendor dir checking" https://github.com/coreos/coreos-installer/pull/802 for https://github.com/coreos/fedora-coreos-tracker/issues/1116. --- ...ckdev-rework-EFI-vendor-dir-checking.patch | 42 +++++++++++++++++++ rust-coreos-installer.spec | 11 ++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 0001-blockdev-rework-EFI-vendor-dir-checking.patch diff --git a/0001-blockdev-rework-EFI-vendor-dir-checking.patch b/0001-blockdev-rework-EFI-vendor-dir-checking.patch new file mode 100644 index 0000000..1881fce --- /dev/null +++ b/0001-blockdev-rework-EFI-vendor-dir-checking.patch @@ -0,0 +1,42 @@ +From 2ddf120b3b924c325a0a95db5386cc35f1c03538 Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Wed, 9 Mar 2022 17:14:14 -0500 +Subject: [PATCH] blockdev: rework EFI vendor dir checking + +On some Dell machines at least, something (UEFI firmware?) creates a +`Dell` directory in the `EFI` dir. This throws off our logic here which +expects only a single vendor dir. + +Let's tweak the logic so that we only consider a "vendor dir" a +directory which has a `grub.cfg`. + +Closes: https://github.com/coreos/fedora-coreos-tracker/issues/1116 +--- + src/blockdev.rs | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/blockdev.rs b/src/blockdev.rs +index 43c7dcf..e8fce45 100644 +--- a/src/blockdev.rs ++++ b/src/blockdev.rs +@@ -930,13 +930,13 @@ pub fn find_efi_vendor_dir(efi_mount: &Mount) -> Result { + let mut vendor_dir: Vec = Vec::new(); + for ent in p.read_dir()? { + let ent = ent.with_context(|| format!("reading directory entry in {}", p.display()))?; +- if ent.file_name() == "BOOT" { +- continue; +- } + if !ent.file_type()?.is_dir() { + continue; + } +- vendor_dir.push(ent.path()); ++ let path = ent.path(); ++ if path.join("grub.cfg").is_file() { ++ vendor_dir.push(path); ++ } + } + if vendor_dir.len() != 1 { + bail!( +-- +2.35.1 + diff --git a/rust-coreos-installer.spec b/rust-coreos-installer.spec index eaee535..6147a7e 100644 --- a/rust-coreos-installer.spec +++ b/rust-coreos-installer.spec @@ -12,7 +12,7 @@ Name: rust-%{crate} Version: 0.13.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Installer for Fedora CoreOS and RHEL CoreOS # Upstream license specification: Apache-2.0 @@ -23,6 +23,10 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{ Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz Source2: https://github.com/coreos/coreos-installer-dracut/archive/%{dracutcommit}/coreos-installer-dracut-%{dracutshortcommit}.tar.gz +# https://github.com/coreos/coreos-installer/pull/802 for +# https://github.com/coreos/fedora-coreos-tracker/issues/1116 +Patch0: 0001-blockdev-rework-EFI-vendor-dir-checking.patch + ExclusiveArch: %{rust_arches} %if 0%{?rhel} && !0%{?eln} BuildRequires: rust-toolset @@ -190,6 +194,11 @@ from the initramfs. %endif %changelog +* Wed Mar 23 2022 Jonathan Lebon - 0.13.1-3 +- Backport "blockdev: rework EFI vendor dir checking" + https://github.com/coreos/coreos-installer/pull/802 for + https://github.com/coreos/fedora-coreos-tracker/issues/1116 + * Tue Feb 15 2022 Zbigniew Jędrzejewski-Szmek - 0.13.1-2 - Rebuild with package notes