Load group names from a group-format file at `path` within `root`, returning an empty set if the file doesn't exist.
(root: &Dir, path: &str)
| 44 | /// Load group names from a group-format file at `path` within `root`, returning |
| 45 | /// an empty set if the file doesn't exist. |
| 46 | fn load_groupnames(root: &Dir, path: &str) -> Result<HashSet<String>> { |
| 47 | use bootc_sysusers::nameservice::group::parse_group_content; |
| 48 | let mut names = HashSet::new(); |
| 49 | if let Some(f) = root |
| 50 | .open_optional(path) |
| 51 | .with_context(|| format!("Opening {path}"))? |
| 52 | { |
| 53 | let entries = parse_group_content(std::io::BufReader::new(f)) |
| 54 | .with_context(|| format!("Parsing {path}"))?; |
| 55 | names.extend(entries.into_iter().map(|e| e.name)); |
| 56 | } |
| 57 | Ok(names) |
| 58 | } |
| 59 | |
| 60 | // ── RemovedEntries ──────────────────────────────────────────────────────────── |
| 61 |
no test coverage detected