|
5 | 5 | */ |
6 | 6 |
|
7 | 7 | use std::cell::RefCell; |
| 8 | +use std::collections::BTreeMap; |
8 | 9 | use std::os::unix::io::AsRawFd; |
9 | 10 | use std::path::{Path, PathBuf}; |
10 | 11 | use std::process::Command; |
@@ -580,14 +581,26 @@ impl Component for Efi { |
580 | 581 | .as_ref() |
581 | 582 | .ok_or_else(|| anyhow::anyhow!("No filetree for installed EFI found!"))?; |
582 | 583 |
|
| 584 | + // Remove EFI prefix of the current filetree children path |
| 585 | + // "shim/<ver>/EFI/fedora/shim.efi" -> "fedora/shim.efi" |
| 586 | + let mut prune_children = BTreeMap::new(); |
| 587 | + for (pathstr, info) in currentf.children.iter() { |
| 588 | + let path = Utf8Path::new(pathstr); |
| 589 | + let prune_path = filetree::get_dest_efi_path(path).to_string(); |
| 590 | + prune_children.insert(prune_path, info.to_owned()); |
| 591 | + } |
| 592 | + let curentf_prune = filetree::FileTree { |
| 593 | + children: prune_children, |
| 594 | + }; |
| 595 | + |
583 | 596 | let mut errs = Vec::new(); |
584 | 597 | let esp_devices = esp_devices.unwrap_or_default(); |
585 | 598 | for esp in esp_devices.iter() { |
586 | 599 | let destpath = &self.ensure_mounted_esp(Path::new("/"), Path::new(&esp))?; |
587 | 600 |
|
588 | 601 | let efidir = openat::Dir::open(&destpath.join("EFI")) |
589 | 602 | .with_context(|| format!("opening EFI dir {}", destpath.display()))?; |
590 | | - let diff = currentf.relative_diff_to(&efidir)?; |
| 603 | + let diff = curentf_prune.relative_diff_to(&efidir)?; |
591 | 604 |
|
592 | 605 | for f in diff.changes.iter() { |
593 | 606 | errs.push(format!("Changed: {}", f)); |
|
0 commit comments