Skip to content

Commit c17b92c

Browse files
committed
efi: to get esp part during installation, if failed via
`/dev/disk/by-partlabel`, change to `sfdisk` During `bootc install to-disk`, the esp device is not mounted and will call `get_esp_device()` to get esp device via `/dev/disk/by-partlabel/`. When running `cosa build`, the efi part is mounted and can not get get esp device via `/dev/disk/by-partlabel`, with this patch, change to `sfdik` to get esp part.
1 parent 9ef528d commit c17b92c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/efi.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,16 @@ impl Component for Efi {
321321
log::debug!("Found metadata {}", meta.version);
322322
let srcdir_name = component_updatedirname(self);
323323
let ft = crate::filetree::FileTree::new_from_dir(&src_root.sub_dir(&srcdir_name)?)?;
324-
// get esp device via /dev/disk/by-partlabel
325-
let esp_device = self
326-
.get_esp_device()
327-
.ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?;
324+
325+
// Get esp device via /dev/disk/by-partlabel
326+
// If failed, change to sfdisk
327+
let esp_device = if let Some(esp) = self.get_esp_device() {
328+
esp
329+
} else {
330+
let esp = blockdev::get_esp_partition(device)?
331+
.ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?;
332+
PathBuf::from(esp)
333+
};
328334
let destpath = &self.ensure_mounted_esp(Path::new(dest_root), &esp_device)?;
329335

330336
let destd = &openat::Dir::open(destpath)

0 commit comments

Comments
 (0)