Created
June 26, 2025 18:37
-
-
Save cgwalters/501e267982553e1104e4d1ca066b6ea5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
diff --git i/lib/src/spec.rs w/lib/src/spec.rs | |
index 18d67540..2d8593fd 100644 | |
--- i/lib/src/spec.rs | |
+++ w/lib/src/spec.rs | |
@@ -176,6 +176,9 @@ pub struct BootEntry { | |
pub incompatible: bool, | |
/// Whether this entry will be subject to garbage collection | |
pub pinned: bool, | |
+ /// This is true if (relative to the booted system) this is a possible target for a soft reboot | |
+ #[serde(default)] | |
+ pub soft_reboot_capable: bool, | |
/// The container storage backend | |
#[serde(default)] | |
pub store: Option<Store>, | |
@@ -517,6 +520,7 @@ mod tests { | |
image: None, | |
cached_update: None, | |
incompatible: false, | |
+ soft_reboot_capable: false, | |
pinned: false, | |
store: None, | |
ostree: None, | |
diff --git i/lib/src/status.rs w/lib/src/status.rs | |
index 04bb0443..2663228a 100644 | |
--- i/lib/src/status.rs | |
+++ w/lib/src/status.rs | |
@@ -113,6 +113,7 @@ pub(crate) fn labels_of_config( | |
fn boot_entry_from_deployment( | |
sysroot: &Storage, | |
deployment: &ostree::Deployment, | |
+ booted_kernel_checksum: Option<&str>, | |
) -> Result<BootEntry> { | |
let ( | |
store, | |
@@ -143,10 +144,14 @@ fn boot_entry_from_deployment( | |
(None, CachedImageStatus::default(), false) | |
}; | |
+ let bootcsum = deployment.bootcsum(); | |
+ let soft_reboot_capable = booted_kernel_checksum == Some(bootcsum.as_ref()); | |
+ | |
let r = BootEntry { | |
image, | |
cached_update, | |
incompatible, | |
+ soft_reboot_capable, | |
store, | |
pinned: deployment.is_pinned(), | |
ostree: Some(crate::spec::BootEntryOstree { | |
@@ -227,27 +232,29 @@ pub(crate) fn get_status( | |
other, | |
}; | |
+ let booted_kernel_checksum = booted_deployment.as_ref().map(|d| d.bootcsum()); | |
+ let booted_kernel_checksum = booted_kernel_checksum.as_deref(); | |
+ let booted = booted_deployment | |
+ .as_ref() | |
+ .map(|d| boot_entry_from_deployment(sysroot, d, None)) | |
+ .transpose() | |
+ .context("Booted deployment")?; | |
let staged = deployments | |
.staged | |
.as_ref() | |
- .map(|d| boot_entry_from_deployment(sysroot, d)) | |
+ .map(|d| boot_entry_from_deployment(sysroot, d, booted_kernel_checksum)) | |
.transpose() | |
.context("Staged deployment")?; | |
- let booted = booted_deployment | |
- .as_ref() | |
- .map(|d| boot_entry_from_deployment(sysroot, d)) | |
- .transpose() | |
- .context("Booted deployment")?; | |
let rollback = deployments | |
.rollback | |
.as_ref() | |
- .map(|d| boot_entry_from_deployment(sysroot, d)) | |
+ .map(|d| boot_entry_from_deployment(sysroot, d, booted_kernel_checksum)) | |
.transpose() | |
.context("Rollback deployment")?; | |
let other_deployments = deployments | |
.other | |
.iter() | |
- .map(|d| boot_entry_from_deployment(sysroot, d)) | |
+ .map(|d| boot_entry_from_deployment(sysroot, d, booted_kernel_checksum)) | |
.collect::<Result<Vec<_>>>() | |
.context("Other deployments")?; | |
let spec = staged | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment