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

Function find_missing_tmpfiles_current_root

crates/tmpfiles/src/lib.rs:425–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

423/// Convert /var for the current root to use systemd tmpfiles.d.
424#[allow(unsafe_code)]
425pub fn find_missing_tmpfiles_current_root() -> Result<TmpfilesResult> {
426 use uzers::cache::UsersSnapshot;
427
428 let rootfs = Dir::open_ambient_dir("/", cap_std::ambient_authority())?;
429
430 // See the docs for why this is unsafe
431 let usergroups = unsafe { UsersSnapshot::new() };
432
433 let existing_tmpfiles = read_tmpfiles(&rootfs)?.0;
434
435 let mut prefix = PathBuf::from("/var");
436 let mut tmpfiles = BTreeSet::new();
437 let mut unsupported = Vec::new();
438 convert_path_to_tmpfiles_d_recurse(
439 &TmpfilesConvertConfig {
440 users: &usergroups,
441 groups: &usergroups,
442 rootfs: &rootfs,
443 existing: &existing_tmpfiles,
444 readonly: true,
445 },
446 &mut tmpfiles,
447 &mut unsupported,
448 &mut prefix,
449 )?;
450 Ok(TmpfilesResult {
451 tmpfiles,
452 unsupported,
453 })
454}
455
456/// Read all tmpfiles.d entries from a single directory
457fn read_tmpfiles_from_dir(

Callers 1

check_var_tmpfilesFunction · 0.85

Calls 2

read_tmpfilesFunction · 0.85

Tested by

no test coverage detected