Skip to content

Commit f4976cb

Browse files
committed
efi: Extend update() to support usr/lib/efi
1 parent caf0187 commit f4976cb

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/efi.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,20 @@ impl Component for Efi {
319319
return Ok(None);
320320
};
321321

322+
let updated_path = {
323+
let efilib_path = rootcxt.path.join(EFILIB);
324+
if efilib_path.exists() && get_efi_component_from_usr(&rootcxt.path, EFILIB)?.is_some()
325+
{
326+
PathBuf::from(EFILIB)
327+
} else {
328+
component_updatedirname(self)
329+
}
330+
};
331+
322332
let updated = rootcxt
323333
.sysroot
324-
.sub_dir(&component_updatedirname(self))
325-
.context("opening update dir")?;
334+
.sub_dir(&updated_path)
335+
.with_context(|| format!("opening update dir {}", updated_path.display()))?;
326336
let updatef = filetree::FileTree::new_from_dir(&updated).context("reading update dir")?;
327337

328338
let esp_devices = esp_devices.unwrap_or_default();
@@ -450,9 +460,22 @@ impl Component for Efi {
450460
.ok_or_else(|| anyhow::anyhow!("No filetree for installed EFI found!"))?;
451461
let sysroot_dir = &rootcxt.sysroot;
452462
let updatemeta = self.query_update(sysroot_dir)?.expect("update available");
453-
let updated = sysroot_dir
454-
.sub_dir(&component_updatedirname(self))
455-
.context("opening update dir")?;
463+
464+
let updated_path = {
465+
let efilib_path = rootcxt.path.join(EFILIB);
466+
if efilib_path.exists() && get_efi_component_from_usr(&rootcxt.path, EFILIB)?.is_some()
467+
{
468+
PathBuf::from(EFILIB)
469+
} else {
470+
component_updatedirname(self)
471+
}
472+
};
473+
474+
let updated = rootcxt
475+
.sysroot
476+
.sub_dir(&updated_path)
477+
.with_context(|| format!("opening update dir {}", updated_path.display()))?;
478+
456479
let updatef = filetree::FileTree::new_from_dir(&updated).context("reading update dir")?;
457480
let diff = currentf.diff(&updatef)?;
458481

0 commit comments

Comments
 (0)