From fa9924e4fe403c3751392c041cd98614a2cc3611 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 31 Jan 2024 10:44:00 -0500 Subject: [PATCH] model: Add tracking of our own static config versions Currently our static configs don't directly support updates. (They really should) We also have a use case around simply introspecting the state that static configs were enabled (xref https://github.com/ostreedev/ostree/pull/3150) where we want to have ostree not run grub2-mkconfig in this case. In preparation for both of these things, add tracking of our *own* version of the static configs into the metadata. In theory of course, static configs could include other components (ignition, greenboot, etc.) and we should track those too. For now this at least gets us basic metadata. --- .github/workflows/ci.yml | 2 ++ src/bootupd.rs | 2 ++ src/model.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c31ae03..dc6eb6b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,3 +46,5 @@ jobs: -v /var/lib/containers:/var/lib/containers \ localhost/bootupd:latest bootc install to-filesystem --skip-fetch-check \ --disable-selinux --replace=alongside /target + # Verify we injected static configs + jq -re '.["static-configs"].version' /boot/bootupd-state.json diff --git a/src/bootupd.rs b/src/bootupd.rs index f5a8529d..0835fa23 100644 --- a/src/bootupd.rs +++ b/src/bootupd.rs @@ -108,6 +108,8 @@ pub(crate) fn install( match configs.enabled_with_uuid() { Some(uuid) => { + let self_meta = crate::packagesystem::query_files("/", ["/usr/bin/bootupctl"])?; + state.static_configs = Some(self_meta); #[cfg(any( target_arch = "x86_64", target_arch = "aarch64", diff --git a/src/model.rs b/src/model.rs index 89018d02..d7b2dff6 100644 --- a/src/model.rs +++ b/src/model.rs @@ -50,6 +50,8 @@ pub(crate) struct SavedState { pub(crate) installed: BTreeMap, /// Maps a component name to an in progress update pub(crate) pending: Option>, + /// If static bootloader configs are enabled, this contains the version + pub(crate) static_configs: Option, } /// The status of an individual component.