diff --git a/rust/tool/shared/src/esp.rs b/rust/tool/shared/src/esp.rs index 9437cb0..348e64c 100644 --- a/rust/tool/shared/src/esp.rs +++ b/rust/tool/shared/src/esp.rs @@ -53,7 +53,7 @@ impl Architecture { /// Generic ESP paths which can be specific to a bootloader pub trait EspPaths { /// Build an ESP path structure out of the ESP root directory - fn new(esp: impl AsRef) -> Self; + fn new(esp: impl AsRef, arch: Architecture) -> Self; /// Return the used file paths to store as garbage collection roots. fn iter(&self) -> std::array::IntoIter<&PathBuf, N>; diff --git a/rust/tool/systemd/src/install.rs b/rust/tool/systemd/src/install.rs index c5fc764..d0de11d 100644 --- a/rust/tool/systemd/src/install.rs +++ b/rust/tool/systemd/src/install.rs @@ -45,8 +45,8 @@ impl Installer { generation_links: Vec, ) -> Self { let mut gc_roots = Roots::new(); - let esp_paths = SystemdEspPaths::new(esp); - gc_roots.extend(esp_paths.iter()); + let esp_paths = EspPaths::new(esp, target_arch); + gc_roots.extend(esp_paths.to_iter()); Self { broken_gens: BTreeSet::new(), diff --git a/rust/tool/systemd/tests/common/mod.rs b/rust/tool/systemd/tests/common/mod.rs index 82d9380..0e1182c 100644 --- a/rust/tool/systemd/tests/common/mod.rs +++ b/rust/tool/systemd/tests/common/mod.rs @@ -156,6 +156,8 @@ pub fn lanzaboote_install( .env("LANZABOOTE_STUB", test_systemd_stub) .arg("-vv") .arg("install") + .arg("--system") + .arg(TARGET_SYSTEM_DOUBLE) .arg("--systemd") .arg(test_systemd) .arg("--systemd-boot-loader-config") diff --git a/rust/tool/systemd/tests/systemd_boot.rs b/rust/tool/systemd/tests/systemd_boot.rs index 03eb803..53e5fbe 100644 --- a/rust/tool/systemd/tests/systemd_boot.rs +++ b/rust/tool/systemd/tests/systemd_boot.rs @@ -2,6 +2,8 @@ use std::fs; use std::path::PathBuf; use anyhow::Result; +use lanzaboote_tool::architecture::Architecture; +use lzbt_systemd::architecture::SystemdArchitectureExt; use tempfile::tempdir; mod common; @@ -113,9 +115,15 @@ fn overwrite_unsigned_systemd_boot_binaries() -> Result<()> { } fn systemd_boot_path(esp: &tempfile::TempDir) -> PathBuf { - esp.path().join("EFI/systemd/systemd-bootx64.efi") + let arch = Architecture::from_nixos_system(TARGET_SYSTEM_DOUBLE).unwrap(); + esp.path() + .join("EFI/systemd/") + .join(arch.systemd_filename()) } fn systemd_boot_fallback_path(esp: &tempfile::TempDir) -> PathBuf { - esp.path().join("EFI/BOOT/BOOTX64.EFI") + let arch = Architecture::from_nixos_system(TARGET_SYSTEM_DOUBLE).unwrap(); + esp.path() + .join("EFI/BOOT/") + .join(arch.efi_fallback_filename()) }