Skip to content

Commit

Permalink
main: Don't use package system to query our own version
Browse files Browse the repository at this point in the history
When we were reworking `bootc install` to try to run outside
of a container, we hit on the fact that this query required
rpm in the *host* context which is conceptually broken.

As part of severing our dependency on rpm (and package systems)
in general let's just use our own crate version which we know
at compile time.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Nov 21, 2024
1 parent e22d3bb commit 97c255e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bootupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::efi;
use crate::model::{ComponentStatus, ComponentUpdatable, ContentMetadata, SavedState, Status};
use crate::util;
use anyhow::{anyhow, Context, Result};
use clap::crate_version;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -96,7 +97,12 @@ pub(crate) fn install(

match configs.enabled_with_uuid() {
Some(uuid) => {
let self_meta = crate::packagesystem::query_files("/", ["/usr/bin/bootupctl"])?;
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);
#[cfg(any(
target_arch = "x86_64",
Expand Down

0 comments on commit 97c255e

Please sign in to comment.