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.
This commit is contained in:
Jonathan Lebon 2022-03-23 17:23:59 -04:00
parent e801ff8f0c
commit 504d860466
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 2ddf120b3b924c325a0a95db5386cc35f1c03538 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
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<PathBuf> {
let mut vendor_dir: Vec<PathBuf> = 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

View File

@ -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 <jonathan@jlebon.com> - 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 <zbyszek@in.waw.pl> - 0.13.1-2
- Rebuild with package notes