Check for a few files and directories we expect in the base image.
(dir: &Dir, _config: &LintExecutionConfig)
| 594 | |
| 595 | /// Check for a few files and directories we expect in the base image. |
| 596 | fn check_baseimage_root_norecurse(dir: &Dir, _config: &LintExecutionConfig) -> LintResult { |
| 597 | // Check /sysroot |
| 598 | let meta = dir.symlink_metadata_optional("sysroot")?; |
| 599 | match meta { |
| 600 | Some(meta) if !meta.is_dir() => return lint_err("Expected a directory for /sysroot"), |
| 601 | None => return lint_err("Missing /sysroot"), |
| 602 | _ => {} |
| 603 | } |
| 604 | |
| 605 | // Check /ostree -> sysroot/ostree |
| 606 | let Some(meta) = dir.symlink_metadata_optional("ostree")? else { |
| 607 | return lint_err("Missing ostree -> sysroot/ostree link"); |
| 608 | }; |
| 609 | if !meta.is_symlink() { |
| 610 | return lint_err("/ostree should be a symlink"); |
| 611 | } |
| 612 | let link = dir.read_link_contents("ostree")?; |
| 613 | let expected = "sysroot/ostree"; |
| 614 | if link.as_os_str().as_bytes() != expected.as_bytes() { |
| 615 | return lint_err(format!("Expected /ostree -> {expected}, not {link:?}")); |
| 616 | } |
| 617 | |
| 618 | lint_ok() |
| 619 | } |
| 620 | |
| 621 | /// Check ostree-related base image content. |
| 622 | #[distributed_slice(LINTS)] |
no test coverage detected