| 765 | check_boot, |
| 766 | ); |
| 767 | fn check_boot(root: &Dir, config: &LintExecutionConfig) -> LintResult { |
| 768 | let Some(d) = root.open_dir_optional("boot")? else { |
| 769 | return lint_err("Missing /boot directory"); |
| 770 | }; |
| 771 | |
| 772 | // First collect all entries to determine if the directory is empty |
| 773 | let entries: Result<BTreeSet<_>, _> = d |
| 774 | .entries()? |
| 775 | .into_iter() |
| 776 | .map(|v| { |
| 777 | let v = v?; |
| 778 | anyhow::Ok(v.file_name()) |
| 779 | }) |
| 780 | .collect(); |
| 781 | let mut entries = entries?; |
| 782 | { |
| 783 | // Work around https://github.com/containers/composefs-rs/issues/131 |
| 784 | let efidir = Utf8Path::new(EFI_LINUX) |
| 785 | .parent() |
| 786 | .map(|b| b.as_std_path()) |
| 787 | .unwrap(); |
| 788 | entries.remove(efidir.as_os_str()); |
| 789 | } |
| 790 | if entries.is_empty() { |
| 791 | return lint_ok(); |
| 792 | } |
| 793 | |
| 794 | let header = "Found non-empty /boot"; |
| 795 | let items = entries.iter().map(PathQuotedDisplay::new); |
| 796 | format_lint_err_from_items(config, header, items) |
| 797 | } |
| 798 | |
| 799 | /// Directories that should be empty in container images. |
| 800 | /// These are tmpfs at runtime and any content is build-time artifacts. |