Skip to content

Commit a557143

Browse files
authored
Merge pull request #728 from cgwalters/storage-install-time
storage: Two prep changes
2 parents 45178c3 + fe6407a commit a557143

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ pub(crate) async fn get_locked_sysroot() -> Result<ostree_ext::sysroot::SysrootL
433433
#[context("Initializing storage")]
434434
pub(crate) async fn get_storage() -> Result<crate::store::Storage> {
435435
let sysroot = get_locked_sysroot().await?;
436-
Ok(crate::store::Storage::new(sysroot))
436+
crate::store::Storage::new(sysroot)
437437
}
438438

439439
#[context("Querying root privilege")]

lib/src/install.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use self::baseline::InstallBlockDeviceOpts;
4444
use crate::containerenv::ContainerExecutionInfo;
4545
use crate::mount::Filesystem;
4646
use crate::spec::ImageReference;
47+
use crate::store::Storage;
4748
use crate::task::Task;
4849
use crate::utils::sigpolicy_from_opts;
4950

@@ -549,7 +550,7 @@ pub(crate) fn print_configuration() -> Result<()> {
549550
}
550551

551552
#[context("Creating ostree deployment")]
552-
async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result<ostree::Sysroot> {
553+
async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result<Storage> {
553554
let sepolicy = state.load_policy()?;
554555
let sepolicy = sepolicy.as_ref();
555556
// Load a fd for the mounted target physical root
@@ -608,7 +609,8 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
608609

609610
let sysroot = ostree::Sysroot::new(Some(&gio::File::for_path(rootfs)));
610611
sysroot.load(cancellable)?;
611-
Ok(sysroot)
612+
let sysroot = SysrootLock::new_from_sysroot(&sysroot).await?;
613+
Storage::new(sysroot)
612614
}
613615

614616
#[context("Creating ostree deployment")]
@@ -1270,11 +1272,10 @@ async fn prepare_install(
12701272
async fn install_with_sysroot(
12711273
state: &State,
12721274
rootfs: &RootSetup,
1273-
sysroot: &ostree::Sysroot,
1275+
sysroot: &Storage,
12741276
boot_uuid: &str,
12751277
bound_images: &[crate::boundimage::ResolvedBoundImage],
12761278
) -> Result<()> {
1277-
let sysroot = SysrootLock::new_from_sysroot(&sysroot).await?;
12781279
// And actually set up the container in that root, returning a deployment and
12791280
// the aleph state (see below).
12801281
let (deployment, aleph) = install_container(state, rootfs, &sysroot).await?;

lib/src/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Deref for Storage {
4848
}
4949

5050
impl Storage {
51-
pub fn new(sysroot: SysrootLock) -> Self {
51+
pub fn new(sysroot: SysrootLock) -> Result<Self> {
5252
let store = match env::var("BOOTC_STORAGE") {
5353
Ok(val) => crate::spec::Store::from_str(&val, true).unwrap_or_else(|_| {
5454
let default = crate::spec::Store::default();
@@ -60,7 +60,7 @@ impl Storage {
6060

6161
let store = load(store);
6262

63-
Self { sysroot, store }
63+
Ok(Self { sysroot, store })
6464
}
6565
}
6666

0 commit comments

Comments
 (0)