MCPcopy Create free account
hub / github.com/bootc-dev/bootc / read_tmpfiles

Function read_tmpfiles

crates/tmpfiles/src/lib.rs:500–512  ·  view source on GitHub ↗

Read all tmpfiles.d entries in the target directory, and return a mapping from (file path) => (single tmpfiles.d entry line) This function reads from both `/usr/lib/tmpfiles.d` and `/etc/tmpfiles.d`, with `/etc` entries taking precedence (matching systemd's behavior).

(rootfs: &Dir)

Source from the content-addressed store, hash-verified

498/// This function reads from both `/usr/lib/tmpfiles.d` and `/etc/tmpfiles.d`,
499/// with `/etc` entries taking precedence (matching systemd's behavior).
500fn read_tmpfiles(rootfs: &Dir) -> Result<(BTreeMap<PathBuf, String>, BootcTmpfilesGeneration)> {
501 let mut generation = BootcTmpfilesGeneration::default();
502
503 // Read from /usr/lib/tmpfiles.d first (system/package-provided)
504 let mut result = read_tmpfiles_from_dir(rootfs, TMPFILESD, &mut generation)?;
505
506 // Read from /etc/tmpfiles.d and merge (user-provided, takes precedence)
507 let etc_result = read_tmpfiles_from_dir(rootfs, ETC_TMPFILESD, &mut generation)?;
508 // /etc entries override /usr/lib entries for the same path
509 result.extend(etc_result);
510
511 Ok((result, generation))
512}
513
514fn tmpfiles_entry_get_path(line: &str) -> Result<PathBuf> {
515 let err = || Error::MalformedTmpfilesEntry(line.to_string());

Callers 2

var_to_tmpfilesFunction · 0.85

Calls 2

read_tmpfiles_from_dirFunction · 0.85
extendMethod · 0.45

Tested by

no test coverage detected