Skip to content

Commit

Permalink
colin patch
Browse files Browse the repository at this point in the history
  • Loading branch information
omertuc committed Sep 9, 2024
1 parent 1ba8d1e commit 8c0575e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub(crate) struct SwitchOpts {

/// Target image to use for the next boot.
pub(crate) target: String,

#[clap(long)]
pub(crate) stateroot: Option<String>,
}

/// Options controlling rollback
Expand Down Expand Up @@ -713,7 +716,9 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
}
}

let stateroot = booted_deployment.osname();
let osname = booted_deployment.osname();
let stateroot = opts.stateroot.as_deref().unwrap_or_else(|| osname.as_str());

crate::deploy::stage(sysroot, &stateroot, &fetched, &new_spec).await?;

if opts.apply {
Expand Down
10 changes: 8 additions & 2 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ pub(crate) struct InstallConfigOpts {
#[clap(long, hide = true)]
#[serde(default)]
pub(crate) skip_bound_images: bool,

#[clap(long)]
pub(crate) stateroot: Option<String>,
}

#[derive(Debug, Clone, clap::Parser, Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -567,8 +570,11 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
// Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
crate::lsm::ensure_dir_labeled(rootfs_dir, "", Some("/".into()), 0o755.into(), sepolicy)?;

// TODO: make configurable?
let stateroot = STATEROOT_DEFAULT;
let stateroot = state
.config_opts
.stateroot
.as_deref()
.unwrap_or(STATEROOT_DEFAULT);
Task::new_and_run(
"Initializing ostree layout",
"ostree",
Expand Down

0 comments on commit 8c0575e

Please sign in to comment.