Given a baseline root filesystem with an ostree sysroot initialized: - install the container to that root - install the bootloader - Other post operations, such as pulling bound images
(
state: &State,
rootfs: &RootSetup,
storage: &Storage,
boot_uuid: &str,
bound_images: BoundImages,
has_ostree: bool,
)
| 1836 | /// - install the bootloader |
| 1837 | /// - Other post operations, such as pulling bound images |
| 1838 | async fn install_with_sysroot( |
| 1839 | state: &State, |
| 1840 | rootfs: &RootSetup, |
| 1841 | storage: &Storage, |
| 1842 | boot_uuid: &str, |
| 1843 | bound_images: BoundImages, |
| 1844 | has_ostree: bool, |
| 1845 | ) -> Result<()> { |
| 1846 | let ostree = storage.get_ostree()?; |
| 1847 | let c_storage = storage.get_ensure_imgstore()?; |
| 1848 | |
| 1849 | // And actually set up the container in that root, returning a deployment and |
| 1850 | // the aleph state (see below). |
| 1851 | let (deployment, aleph) = install_container(state, rootfs, ostree, storage, has_ostree).await?; |
| 1852 | // Write the aleph data that captures the system state at the time of provisioning for aid in future debugging. |
| 1853 | aleph.write_to(&rootfs.physical_root)?; |
| 1854 | |
| 1855 | let deployment_path = ostree.deployment_dirpath(&deployment); |
| 1856 | |
| 1857 | let deployment_dir = rootfs |
| 1858 | .physical_root |
| 1859 | .open_dir(&deployment_path) |
| 1860 | .context("Opening deployment dir")?; |
| 1861 | let postfetch = PostFetchState::new(state, &deployment_dir)?; |
| 1862 | |
| 1863 | if cfg!(target_arch = "s390x") { |
| 1864 | // TODO: Integrate s390x support into install_via_bootupd |
| 1865 | // zipl only supports single device |
| 1866 | crate::bootloader::install_via_zipl(&rootfs.device_info.require_single_root()?, boot_uuid)?; |
| 1867 | } else { |
| 1868 | match postfetch.detected_bootloader { |
| 1869 | Bootloader::Grub => { |
| 1870 | crate::bootloader::install_via_bootupd( |
| 1871 | &rootfs.device_info, |
| 1872 | &rootfs |
| 1873 | .target_root_path |
| 1874 | .clone() |
| 1875 | .unwrap_or(rootfs.physical_root_path.clone()), |
| 1876 | &state.config_opts, |
| 1877 | Some(&deployment_path.as_str()), |
| 1878 | )?; |
| 1879 | } |
| 1880 | Bootloader::Systemd | Bootloader::GrubCC => { |
| 1881 | anyhow::bail!("bootupd is required for ostree-based installs"); |
| 1882 | } |
| 1883 | Bootloader::None => { |
| 1884 | tracing::debug!("Skip bootloader installation due set to None"); |
| 1885 | } |
| 1886 | } |
| 1887 | } |
| 1888 | tracing::debug!("Installed bootloader"); |
| 1889 | |
| 1890 | tracing::debug!("Performing post-deployment operations"); |
| 1891 | |
| 1892 | match bound_images { |
| 1893 | BoundImages::Skip => {} |
| 1894 | BoundImages::Resolved(resolved_bound_images) => { |
| 1895 | // Now copy each bound image from the host's container storage into the target. |
no test coverage detected