Skip to content

Commit ea67b9f

Browse files
committed
blockdev: support bootloader update on MBR
Based on updates in bootc-dev/bootc#1773 Fixes: #1019
1 parent 37fa74d commit ea67b9f

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/blockdev.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,10 @@ pub fn get_devices<P: AsRef<Path>>(target_root: P) -> Result<Vec<String>> {
3939
/// Find esp partition on the same device
4040
/// using sfdisk to get partitiontable
4141
pub fn get_esp_partition(device: &str) -> Result<Option<String>> {
42-
const ESP_TYPE_GUID: &str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
4342
let device_info: PartitionTable =
4443
bootc_internal_blockdev::partitions_of(Utf8Path::new(device))?;
45-
let esp = device_info
46-
.partitions
47-
.into_iter()
48-
.find(|p| p.parttype.as_str() == ESP_TYPE_GUID);
49-
if let Some(esp) = esp {
50-
return Ok(Some(esp.node));
51-
}
52-
Ok(None)
44+
let esp = device_info.find_partition_of_esp()?;
45+
Ok(esp.map(|v| v.node.clone()))
5346
}
5447

5548
/// Find all ESP partitions on the devices

0 commit comments

Comments
 (0)