Skip to content

Commit

Permalink
backend: Make --generate-update-metadata require a sysroot of /
Browse files Browse the repository at this point in the history
As of right now all known callers of this pass `/`.  More generally
we now expect bootupd to run in a container inside its target
root; never outside of it.

xref coreos/coreos-assembler#3631
  • Loading branch information
cgwalters committed Sep 29, 2023
1 parent ab1516e commit 50c9850
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cli/bootupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct InstallOpts {
pub struct GenerateOpts {
/// Physical root mountpoint
#[clap(value_parser)]
sysroot: String,
sysroot: Option<String>,
}

impl DCommand {
Expand All @@ -76,7 +76,11 @@ impl DCommand {

/// Runner for `generate-install-metadata` verb.
pub(crate) fn run_generate_meta(opts: GenerateOpts) -> Result<()> {
bootupd::generate_update_metadata(&opts.sysroot).context("generating metadata failed")?;
let sysroot = opts.sysroot.as_deref().unwrap_or("/");
if sysroot != "/" {
anyhow::bail!("Using a non-default sysroot is not supported: {}", sysroot);
}
bootupd::generate_update_metadata(sysroot).context("generating metadata failed")?;
Ok(())
}

Expand Down

0 comments on commit 50c9850

Please sign in to comment.