From 79bc580c2431d20229d3c191a88cbb48dd48b1c8 Mon Sep 17 00:00:00 2001 From: Omer Tuchfeld Date: Wed, 11 Sep 2024 10:19:37 +0200 Subject: [PATCH] install: `sysroot.init_osname` API instead of CLI Solves #781 This commit replaces the `ostree admin os-init` CLI invocation with the `sysroot.init_osname` API call. This is a more direct way to initialize the stateroot. Signed-off-by: Omer Tuchfeld --- lib/src/install.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/install.rs b/lib/src/install.rs index 4db1ed3f6..c8b3672e5 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -600,13 +600,14 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result .cwd_dir(rootfs_dir.try_clone()?) .run()?; } - Task::new("Initializing sysroot", "ostree") - .args(["admin", "os-init", stateroot, "--sysroot", "."]) - .cwd(rootfs_dir)? - .run()?; let sysroot = ostree::Sysroot::new(Some(&gio::File::for_path(rootfs))); sysroot.load(cancellable)?; + + sysroot + .init_osname(stateroot, cancellable) + .context("initializing stateroot")?; + let sysroot_dir = Dir::reopen_dir(&crate::utils::sysroot_fd(&sysroot))?; state.tempdir.create_dir("temp-run")?;