Skip to content

Commit

Permalink
Merge pull request #541 from cgwalters/hard-error-non-root-sysroot
Browse files Browse the repository at this point in the history
backend: Make --generate-update-metadata require a sysroot of /
  • Loading branch information
jmarrero authored Oct 1, 2023
2 parents ab1516e + 50c9850 commit 50c292a
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 50c292a

Please sign in to comment.