[pve-devel] [PATCH installer v2 06/17] common: setup: deserialize `secure_boot` property from runtime env
Christoph Heiss
c.heiss at proxmox.com
Thu Jul 18 15:48:51 CEST 2024
Needed for the post-hook functionality, which sends this information as
part of its information set.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Changes v1 -> v2:
* new patch
---
Proxmox/Install/RunEnv.pm | 1 +
proxmox-installer-common/src/setup.rs | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm
index 7eaf96a..bb60080 100644
--- a/Proxmox/Install/RunEnv.pm
+++ b/Proxmox/Install/RunEnv.pm
@@ -236,6 +236,7 @@ my sub detect_country_tracing_to : prototype($$) {
# kernel_cmdline = <contents of /proc/cmdline>,
# total_memory = <memory size in MiB>,
# hvm_supported = <1 if the CPU supports hardware-accelerated virtualization>,
+# secure_boot = <1 if SecureBoot is enabled>,
# boot_type = <either 'efi' or 'bios'>,
# disks => <see Proxmox::Sys::Block::hd_list()>,
# network => {
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index ee3d0c9..2ca9641 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -236,6 +236,14 @@ where
Ok(val != 0)
}
+fn deserialize_bool_from_int_maybe<'de, D>(deserializer: D) -> Result<Option<bool>, D::Error>
+where
+ D: Deserializer<'de>,
+{
+ let val: Option<u32> = Deserialize::deserialize(deserializer)?;
+ Ok(val.map(|v| v != 0))
+}
+
fn deserialize_cczones_map<'de, D>(
deserializer: D,
) -> Result<HashMap<String, Vec<String>>, D::Error>
@@ -333,6 +341,10 @@ pub struct RuntimeInfo {
/// Whether the CPU supports hardware-accelerated virtualization
#[serde(deserialize_with = "deserialize_bool_from_int")]
pub hvm_supported: bool,
+
+ /// Whether the system was booted with SecureBoot enabled
+ #[serde(default, deserialize_with = "deserialize_bool_from_int_maybe")]
+ pub secure_boot: Option<bool>,
}
#[derive(Copy, Clone, Eq, Deserialize, PartialEq)]
--
2.45.1
More information about the pve-devel
mailing list