traverse_etc

Function traverse_etc 

Source
pub fn traverse_etc(
    pristine_etc: &Dir,
    current_etc: &Dir,
    new_etc: Option<&Dir>,
) -> Result<(Directory<CustomMetadata>, Directory<CustomMetadata>, Option<Directory<CustomMetadata>>)>
Expand description

Traverses and collects directory trees for three etc states.

Recursively walks through the given pristine, current, and new etc directories, building filesystem trees that capture files, directories, and symlinks. Device files, sockets, pipes etc are ignored

It is primarily used to prepare inputs for later diff computations and comparisons between different etc states.

§Arguments

  • pristine_etc - The reference directory representing the unmodified version or current /etc. Usually this will be obtained by remounting the EROFS image to a temporary location

  • current_etc - The current /etc directory

  • new_etc - The directory representing the /etc directory for a new deployment. This will again be usually obtained by mounting the new EROFS image to a temporary location. If merging it will be necessary to make the /etc for the deployment writeable

§Returns

anyhow::Result containing a tuple of directory trees in the order:

  1. pristine_etc_files – Dirtree of the pristine etc state
  2. current_etc_files – Dirtree of the current etc state
  3. new_etc_files – Dirtree of the new etc state (if new_etc directory is passed)