diff --git a/lib/src/blockdev.rs b/lib/src/blockdev.rs index 9be1d3d65..3c69080fa 100644 --- a/lib/src/blockdev.rs +++ b/lib/src/blockdev.rs @@ -138,10 +138,18 @@ pub(crate) struct Partition { pub(crate) name: Option, } +#[derive(Debug, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub(crate) enum PartitionType { + Dos, + Gpt, + Unknown(String), +} + #[derive(Debug, Deserialize)] #[allow(dead_code)] pub(crate) struct PartitionTable { - pub(crate) label: String, + pub(crate) label: PartitionType, pub(crate) id: String, pub(crate) device: String, // We're not using these fields diff --git a/lib/src/install.rs b/lib/src/install.rs index f20727134..93403b750 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -1338,6 +1338,18 @@ async fn install_to_filesystem_impl(state: &State, rootfs: &mut RootSetup) -> Re // Drop exclusive ownership since we're done with mutation let rootfs = &*rootfs; + match &rootfs.device_info.label { + crate::blockdev::PartitionType::Dos => crate::utils::medium_visibility_warning( + "Installing to `dos` format partitions is not recommended", + ), + crate::blockdev::PartitionType::Gpt => { + // The only thing we should be using in general + } + crate::blockdev::PartitionType::Unknown(o) => { + crate::utils::medium_visibility_warning(&format!("Unknown partition label {o}")) + } + } + // We verify this upfront because it's currently required by bootupd let boot_uuid = rootfs .get_boot_uuid()?