diff --git a/CHANGELOG.md b/CHANGELOG.md index b7b3d9094..7d2b0f5fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## [0.20.3-rc1] +### Changed +- ProcFs generator now allows files to be copied from host verbatim. + ## [0.20.3-rc0] ### Added - ProcFs generator is now suitable for use. diff --git a/Cargo.lock b/Cargo.lock index 06cd4326f..8ffec4992 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1049,7 +1049,7 @@ dependencies = [ [[package]] name = "lading" -version = "0.20.3-rc0" +version = "0.20.3-rc1" dependencies = [ "async-pidfd", "byte-unit", diff --git a/lading/Cargo.toml b/lading/Cargo.toml index 2b23d2cba..0898ba24c 100644 --- a/lading/Cargo.toml +++ b/lading/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lading" -version = "0.20.3-rc0" +version = "0.20.3-rc1" authors = ["Brian L. Troutwine ", "George Hahn Vec { + vec![ + PathBuf::from_str("/proc/uptime").unwrap(), + PathBuf::from_str("/proc/stat").unwrap(), + ] } #[derive(Debug, Deserialize, PartialEq)] @@ -34,6 +46,9 @@ pub struct Config { pub root: PathBuf, /// Total number of processes created pub total_processes: NonZeroU32, + /// Files to copy from host /proc to `root`. + #[serde(default = "default_copy_from_host")] + pub copy_from_host: Vec, } /// The procfs generator. @@ -120,6 +135,17 @@ impl ProcFs { } } + // SAFETY: By construction this pathbuf cannot fail to be created. + let prefix = PathBuf::from_str("/proc").unwrap(); + + for path in &config.copy_from_host { + let base = path.strip_prefix(&prefix)?; + let mut new_path = config.root.clone(); + new_path.push(base); + + fs::copy(path, new_path)?; + } + Ok(Self { shutdown }) }