MCPcopy Create free account
hub / github.com/bootc-dev/bootc / ostree_install

Function ostree_install

crates/lib/src/install.rs:1947–1991  ·  view source on GitHub ↗
(state: &State, rootfs: &RootSetup, cleanup: Cleanup)

Source from the content-addressed store, hash-verified

1945}
1946
1947async fn ostree_install(state: &State, rootfs: &RootSetup, cleanup: Cleanup) -> Result<()> {
1948 // We verify this upfront because it's currently required by bootupd
1949 let boot_uuid = rootfs
1950 .get_boot_uuid()?
1951 .or(rootfs.rootfs_uuid.as_deref())
1952 .ok_or_else(|| anyhow!("No uuid for boot/root"))?;
1953 tracing::debug!("boot uuid={boot_uuid}");
1954
1955 let bound_images = BoundImages::from_state(state).await?;
1956
1957 // Initialize the ostree sysroot (repo, stateroot, etc.)
1958
1959 {
1960 let (sysroot, has_ostree) = initialize_ostree_root(state, rootfs).await?;
1961
1962 install_with_sysroot(
1963 state,
1964 rootfs,
1965 &sysroot,
1966 &boot_uuid,
1967 bound_images,
1968 has_ostree,
1969 )
1970 .await?;
1971 let ostree = sysroot.get_ostree()?;
1972
1973 if matches!(cleanup, Cleanup::TriggerOnNextBoot) {
1974 let sysroot_dir = crate::utils::sysroot_dir(ostree)?;
1975 tracing::debug!("Writing {DESTRUCTIVE_CLEANUP}");
1976 sysroot_dir.atomic_write(DESTRUCTIVE_CLEANUP, b"")?;
1977 }
1978
1979 // Ensure the image storage is SELinux-labeled. This must happen
1980 // after all image pulls are complete.
1981 sysroot.ensure_imgstore_labeled()?;
1982
1983 // We must drop the sysroot here in order to close any open file
1984 // descriptors.
1985 };
1986
1987 // Run this on every install as the penultimate step
1988 install_finalize(&rootfs.physical_root_path).await?;
1989
1990 Ok(())
1991}
1992
1993async fn install_to_filesystem_impl(
1994 state: &State,

Callers 1

Calls 7

initialize_ostree_rootFunction · 0.85
install_with_sysrootFunction · 0.85
sysroot_dirFunction · 0.85
install_finalizeFunction · 0.85
get_boot_uuidMethod · 0.80
get_ostreeMethod · 0.80

Tested by

no test coverage detected