Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Oct 21, 2023
1 parent 083c1af commit a997515
Show file tree
Hide file tree
Showing 9 changed files with 731 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ tempfile = "3.3.0"
toml = "0.7.2"
xshell = { version = "0.2", optional = true }
uuid = { version = "1.2.2", features = ["v4"] }
containers-image-proxy = { version = "0.5.7", features = ["proxy_v0_2_4" ] }

[features]
default = ["install"]
Expand Down
10 changes: 10 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use ostree_ext::container as ostree_container;
use ostree_ext::container::SignatureSource;
use ostree_ext::keyfileext::KeyFileExt;
use ostree_ext::ostree;
use ostree_ext::sysroot::SysrootLock;
use std::ffi::OsString;
use std::io::Seek;
use std::os::unix::process::CommandExt;
Expand Down Expand Up @@ -143,6 +144,9 @@ pub(crate) enum Opt {
/// Add a transient writable overlayfs on `/usr` that will be discarded on reboot.
#[clap(alias = "usroverlay")]
UsrOverlay,
/// Manipulate configuration
#[clap(subcommand)]
Config(crate::config::ConfigOpts),
/// Install to the target block device
#[cfg(feature = "install")]
Install(crate::install::InstallOpts),
Expand Down Expand Up @@ -278,6 +282,11 @@ pub(crate) async fn prepare_for_write() -> Result<()> {
Ok(())
}

pub(crate) fn target_deployment(sysroot: &SysrootLock) -> Result<ostree::Deployment> {
let booted_deployment = sysroot.require_booted_deployment()?;
Ok(sysroot.staged_deployment().unwrap_or(booted_deployment))
}

/// Implementation of the `bootc upgrade` CLI command.
#[context("Upgrading")]
async fn upgrade(opts: UpgradeOpts) -> Result<()> {
Expand Down Expand Up @@ -474,6 +483,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
Opt::Switch(opts) => switch(opts).await,
Opt::Edit(opts) => edit(opts).await,
Opt::UsrOverlay => usroverlay().await,
Opt::Config(opts) => crate::config::run(opts).await,
#[cfg(feature = "install")]
Opt::Install(opts) => crate::install::install(opts).await,
#[cfg(feature = "install")]
Expand Down
Loading

0 comments on commit a997515

Please sign in to comment.