Skip to content

Commit

Permalink
install: sysroot.init_osname API instead of CLI
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
omertuc committed Sep 11, 2024
1 parent 1fd6c69 commit 79bc580
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
Expand Down

0 comments on commit 79bc580

Please sign in to comment.