Skip to content

Commit

Permalink
Merge pull request containers#771 from cgwalters/switch-apply
Browse files Browse the repository at this point in the history
cli: Add `switch --apply`
  • Loading branch information
cgwalters authored Aug 29, 2024
2 parents 698df04 + 16681b9 commit a2c47e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ pub(crate) struct SwitchOpts {
#[clap(long)]
pub(crate) quiet: bool,

/// Restart or reboot into the new target image.
///
/// Currently, this option always reboots. In the future this command
/// will detect the case where no kernel changes are queued, and perform
/// a userspace-only restart.
#[clap(long)]
pub(crate) apply: bool,

/// The transport; e.g. oci, oci-archive, containers-storage. Defaults to `registry`.
#[clap(long, default_value = "registry")]
pub(crate) transport: String,
Expand Down Expand Up @@ -697,6 +705,10 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
let stateroot = booted_deployment.osname();
crate::deploy::stage(sysroot, &stateroot, &fetched, &new_spec).await?;

if opts.apply {
crate::reboot::reboot()?;
}

Ok(())
}

Expand Down

0 comments on commit a2c47e5

Please sign in to comment.