Skip to content

Commit 83a6dee

Browse files
committed
efi: update install() to use updated function
For installation, only support single ESP now
1 parent 0230065 commit 83a6dee

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/efi.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl Component for Efi {
322322
})
323323
}
324324

325-
// TODO: Remove dest_root; it was never actually used
325+
// For installation, only support single ESP now
326326
fn install(
327327
&self,
328328
src_root: &openat::Dir,
@@ -336,9 +336,17 @@ impl Component for Efi {
336336
log::debug!("Found metadata {}", meta.version);
337337
let srcdir_name = component_updatedirname(self);
338338
let ft = crate::filetree::FileTree::new_from_dir(&src_root.sub_dir(&srcdir_name)?)?;
339-
let destdir = &self.ensure_mounted_esp(Path::new(dest_root))?;
339+
let destdir = if let Some(destdir) = self.get_mounted_esp(dest_root)? {
340+
destdir
341+
} else {
342+
let esp_device = self
343+
.get_esp_device()
344+
.ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?;
345+
let esp_device = esp_device.to_str().unwrap();
346+
self.ensure_mounted_esp(dest_root, esp_device)?
347+
};
340348

341-
let destd = &openat::Dir::open(destdir)
349+
let destd = &openat::Dir::open(&destdir)
342350
.with_context(|| format!("opening dest dir {}", destdir.display()))?;
343351
validate_esp_fstype(destd)?;
344352

0 commit comments

Comments
 (0)