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

Function check_boot

crates/lib/src/lints.rs:767–797  ·  view source on GitHub ↗
(root: &Dir, config: &LintExecutionConfig)

Source from the content-addressed store, hash-verified

765 check_boot,
766);
767fn 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.

Callers 1

test_bootFunction · 0.85

Calls 7

lint_errFunction · 0.85
lint_okFunction · 0.85
into_iterMethod · 0.45
removeMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45

Tested by 1

test_bootFunction · 0.68