51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
From afa2291afe49e580d010eff59355371378044a29 Mon Sep 17 00:00:00 2001
|
|
From: Huijing Hei <hhei@redhat.com>
|
|
Date: Fri, 6 Jun 2025 11:43:58 +0800
|
|
Subject: [PATCH 2/3] Add function `get_static_config_meta()` to reuse code
|
|
|
|
(cherry picked from commit cf1703f37f907399e14b5e22c4df6eedc631d5ae)
|
|
---
|
|
src/bootupd.rs | 19 ++++++++++++-------
|
|
1 file changed, 12 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/bootupd.rs b/src/bootupd.rs
|
|
index 5169221..1213654 100644
|
|
--- a/src/bootupd.rs
|
|
+++ b/src/bootupd.rs
|
|
@@ -103,13 +103,8 @@ pub(crate) fn install(
|
|
|
|
match configs.enabled_with_uuid() {
|
|
Some(uuid) => {
|
|
- let self_bin_meta =
|
|
- std::fs::metadata("/proc/self/exe").context("Querying self meta")?;
|
|
- let self_meta = ContentMetadata {
|
|
- timestamp: self_bin_meta.modified()?.into(),
|
|
- version: crate_version!().into(),
|
|
- };
|
|
- state.static_configs = Some(self_meta);
|
|
+ let meta = get_static_config_meta()?;
|
|
+ state.static_configs = Some(meta);
|
|
#[cfg(any(
|
|
target_arch = "x86_64",
|
|
target_arch = "aarch64",
|
|
@@ -133,6 +128,16 @@ pub(crate) fn install(
|
|
Ok(())
|
|
}
|
|
|
|
+#[context("Get static config metadata")]
|
|
+fn get_static_config_meta() -> Result<ContentMetadata> {
|
|
+ let self_bin_meta = std::fs::metadata("/proc/self/exe").context("Querying self meta")?;
|
|
+ let self_meta = ContentMetadata {
|
|
+ timestamp: self_bin_meta.modified()?.into(),
|
|
+ version: crate_version!().into(),
|
|
+ };
|
|
+ Ok(self_meta)
|
|
+}
|
|
+
|
|
type Components = BTreeMap<&'static str, Box<dyn Component>>;
|
|
|
|
#[allow(clippy::box_default)]
|
|
--
|
|
2.49.0
|
|
|