Skip to content

Commit a2c47e5

Browse files
authored
Merge pull request bootc-dev#771 from cgwalters/switch-apply
cli: Add `switch --apply`
2 parents 698df04 + 16681b9 commit a2c47e5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/src/cli.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ pub(crate) struct SwitchOpts {
5959
#[clap(long)]
6060
pub(crate) quiet: bool,
6161

62+
/// Restart or reboot into the new target image.
63+
///
64+
/// Currently, this option always reboots. In the future this command
65+
/// will detect the case where no kernel changes are queued, and perform
66+
/// a userspace-only restart.
67+
#[clap(long)]
68+
pub(crate) apply: bool,
69+
6270
/// The transport; e.g. oci, oci-archive, containers-storage. Defaults to `registry`.
6371
#[clap(long, default_value = "registry")]
6472
pub(crate) transport: String,
@@ -697,6 +705,10 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
697705
let stateroot = booted_deployment.osname();
698706
crate::deploy::stage(sysroot, &stateroot, &fetched, &new_spec).await?;
699707

708+
if opts.apply {
709+
crate::reboot::reboot()?;
710+
}
711+
700712
Ok(())
701713
}
702714

0 commit comments

Comments
 (0)