(state: &State, rootfs: &RootSetup, cleanup: Cleanup)
| 1945 | } |
| 1946 | |
| 1947 | async 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 | |
| 1993 | async fn install_to_filesystem_impl( |
| 1994 | state: &State, |
no test coverage detected