Skip to content

Commit

Permalink
cli: Add switch --apply
Browse files Browse the repository at this point in the history
No reason not to have this.

Closes: containers#770
Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Aug 21, 2024
1 parent 3256b3f commit 16681b9
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 16681b9

Please sign in to comment.