Find the kernel modules directory in checked out directory tree. The target directory will have a `vmlinuz` file representing the kernel binary.
(root: &Dir)
| 58 | /// Find the kernel modules directory in checked out directory tree. |
| 59 | /// The target directory will have a `vmlinuz` file representing the kernel binary. |
| 60 | pub fn find_kernel_dir_fs(root: &Dir) -> Result<Option<Utf8PathBuf>> { |
| 61 | let mut r = None; |
| 62 | let entries = if let Some(entries) = read_dir_optional(root, MODULES)? { |
| 63 | entries |
| 64 | } else { |
| 65 | return Ok(None); |
| 66 | }; |
| 67 | for child in entries { |
| 68 | let child = &child?; |
| 69 | if !child.file_type()?.is_dir() { |
| 70 | continue; |
| 71 | } |
| 72 | let name = child.file_name(); |
| 73 | let name = if let Some(n) = name.to_str() { |
| 74 | n |
| 75 | } else { |
| 76 | continue; |
| 77 | }; |
| 78 | let mut pbuf = Utf8Path::new(MODULES).to_owned(); |
| 79 | pbuf.push(name); |
| 80 | pbuf.push(VMLINUZ); |
| 81 | if !root.try_exists(&pbuf)? { |
| 82 | continue; |
| 83 | } |
| 84 | pbuf.pop(); |
| 85 | if r.replace(pbuf).is_some() { |
| 86 | anyhow::bail!("Found multiple subdirectories in {}", MODULES); |
| 87 | } |
| 88 | } |
| 89 | Ok(r) |
| 90 | } |
| 91 | |
| 92 | /// Check if there is an aboot image in the kernel tree dir |
| 93 | pub fn commit_has_aboot_img( |
no test coverage detected