"Mounting" files in the chroot, in addition to directories

pmeunier
Jun 27, 2025, 10:32 PM
IGILK765PMQRV56NFKU4BNBWL3NIEPGZGE7CQXQIYR5GVU4XOARAC

Dependencies

  • [2] ODUDDQRY Adding the OCaml interface
  • [3] BDEVQIAU Handle cyclic Ubuntu dependencies
  • [4] NWEGAWPP Mounting /proc, /sys and /dev in the chroot

Change contents

  • replacement in src/container.rs at line 500
    [2.57693][2.57693:57992]()
    std::fs::create_dir_all(&guest).unwrap();
    debug!("created {:?} to {:?}", host, guest);
    match mount::Mount::bind(host, guest.to_str().unwrap()) {
    Ok(m) => std::mem::forget(m),
    Err(e) => error!("{e:?}"),
    }
    debug!("mounted {:?}", guest);
    [2.57693]
    [2.57992]
    let meta = std::fs::metadata(&host)?;
  • edit in src/container.rs at line 513
    [2.58487]
    [2.58487]
    if meta.is_dir() {
    std::fs::create_dir_all(&guest).unwrap();
    debug!("created {:?} to {:?}", host, guest);
    match mount::Mount::bind(host, guest.to_str().unwrap()) {
    Ok(m) => std::mem::forget(m),
    Err(e) => error!("{e:?}"),
    }
    debug!("mounted {:?}", guest);
    } else if meta.is_file() {
    debug!("hardlinking file {:?}", guest);
    std::fs::hard_link(&host, &guest)?;
    }