diff --git a/Cargo.lock b/Cargo.lock index 8b6f46d3..dd3cad2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -237,6 +237,23 @@ dependencies = [ "xshell", ] +[[package]] +name = "bootc-sysusers" +version = "0.1.0" +dependencies = [ + "anyhow", + "bootc-utils", + "camino", + "cap-std-ext", + "fn-error-context", + "indoc", + "rustix", + "similar-asserts", + "tempfile", + "thiserror 2.0.11", + "uzers", +] + [[package]] name = "bootc-tmpfiles" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index dcfe3536..2e7f3349 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,8 @@ members = [ "blockdev", "xtask", "tests-integration", - "tmpfiles" + "tmpfiles", + "sysusers", ] resolver = "2" diff --git a/sysusers/Cargo.toml b/sysusers/Cargo.toml new file mode 100644 index 00000000..631d2163 --- /dev/null +++ b/sysusers/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "bootc-sysusers" +version = "0.1.0" +license = "MIT OR Apache-2.0" +edition = "2021" +publish = false + +[dependencies] +camino = { workspace = true } +fn-error-context = { workspace = true } +cap-std-ext = { version = "4" } +thiserror = { workspace = true } +tempfile = { workspace = true } +bootc-utils = { path = "../utils" } +rustix = { workspace = true } +uzers = "0.12" + +[dev-dependencies] +anyhow = { workspace = true } +indoc = { workspace = true } +similar-asserts = { workspace = true } + +[lints] +workspace = true diff --git a/sysusers/src/lib.rs b/sysusers/src/lib.rs new file mode 100644 index 00000000..6aa6c620 --- /dev/null +++ b/sysusers/src/lib.rs @@ -0,0 +1,22 @@ +//! Parse and generate systemd sysusers.d entries. +// SPDX-License-Identifier: Apache-2.0 OR MIT + +use std::path::PathBuf; + +use thiserror::Error; + +/// An error when translating tmpfiles.d. +#[derive(Debug, Error)] +#[allow(missing_docs)] +pub enum Error { + #[error("I/O error: {0}")] + Io(#[from] std::io::Error), + #[error("I/O error on {path}: {err}")] + PathIo { path: PathBuf, err: std::io::Error }, +} + +/// The type of Result. +pub type Result = std::result::Result; + +#[cfg(test)] +mod tests {}