|
7 | 7 | // This sub-module is the "basic" installer that handles creating basic block device
|
8 | 8 | // and filesystem setup.
|
9 | 9 | pub(crate) mod baseline;
|
| 10 | +mod osbuild; |
10 | 11 | pub(crate) mod config;
|
11 | 12 | pub(crate) mod osconfig;
|
12 | 13 |
|
@@ -997,36 +998,6 @@ fn ensure_var() -> Result<()> {
|
997 | 998 | Ok(())
|
998 | 999 | }
|
999 | 1000 |
|
1000 |
| -/// Unfortunately today podman requires that /etc be writable for |
1001 |
| -/// `/etc/containers/networks`. Detect the situation where it's not |
1002 |
| -/// (the main usual cause will be how bootc-image-builder runs us |
1003 |
| -/// via a custom bwrap container today) and work around it by |
1004 |
| -/// mounting a writable transient overlayfs. |
1005 |
| -#[context("Ensuring writable /etc")] |
1006 |
| -fn ensure_writable_etc_containers(tempdir: &Dir) -> Result<()> { |
1007 |
| - let etc_containers = Utf8Path::new("/etc/containers"); |
1008 |
| - // If there's no /etc/containers, nothing to do |
1009 |
| - if !etc_containers.try_exists()? { |
1010 |
| - return Ok(()); |
1011 |
| - } |
1012 |
| - if rustix::fs::access(etc_containers.as_std_path(), rustix::fs::Access::WRITE_OK).is_ok() { |
1013 |
| - return Ok(()); |
1014 |
| - } |
1015 |
| - // Create dirs for the overlayfs upper and work in the install-global tmpdir. |
1016 |
| - tempdir.create_dir_all("etc-ovl/upper")?; |
1017 |
| - tempdir.create_dir("etc-ovl/work")?; |
1018 |
| - let opts = format!("lowerdir={etc_containers},workdir=etc-ovl/work,upperdir=etc-ovl/upper"); |
1019 |
| - let mut t = Task::new( |
1020 |
| - &format!("Mount transient overlayfs for {etc_containers}"), |
1021 |
| - "mount", |
1022 |
| - ) |
1023 |
| - .args(["-t", "overlay", "overlay", "-o", opts.as_str()]) |
1024 |
| - .arg(etc_containers); |
1025 |
| - t.cmd.cwd_dir(tempdir.try_clone()?); |
1026 |
| - t.run()?; |
1027 |
| - Ok(()) |
1028 |
| -} |
1029 |
| - |
1030 | 1001 | /// We want to have proper /tmp and /var/tmp without requiring the caller to set them up
|
1031 | 1002 | /// in advance by manually specifying them via `podman run -v /tmp:/tmp` etc.
|
1032 | 1003 | /// Unfortunately, it's quite complex right now to "gracefully" dynamically reconfigure
|
@@ -1214,7 +1185,7 @@ async fn prepare_install(
|
1214 | 1185 | // creating multiple.
|
1215 | 1186 | let tempdir = cap_std_ext::cap_tempfile::TempDir::new(cap_std::ambient_authority())?;
|
1216 | 1187 | // And continue to init global state
|
1217 |
| - ensure_writable_etc_containers(&tempdir)?; |
| 1188 | + osbuild::adjust_for_bootc_image_builder(&tempdir)?; |
1218 | 1189 |
|
1219 | 1190 | if !target_opts.skip_fetch_check {
|
1220 | 1191 | verify_target_fetch(&tempdir, &target_imgref).await?;
|
|
0 commit comments