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)
| 498 | /// This function reads from both `/usr/lib/tmpfiles.d` and `/etc/tmpfiles.d`, |
| 499 | /// with `/etc` entries taking precedence (matching systemd's behavior). |
| 500 | fn 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 | |
| 514 | fn tmpfiles_entry_get_path(line: &str) -> Result<PathBuf> { |
| 515 | let err = || Error::MalformedTmpfilesEntry(line.to_string()); |
no test coverage detected