diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index b4f7cd76..71f09178 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -22,7 +22,7 @@ parallel build: { """) } shwrap(""" - make install install-grub-static install-systemd-unit DESTDIR=\$(pwd)/insttree/ + make install-all DESTDIR=\$(pwd)/insttree/ tar -c -C insttree/ -zvf insttree.tar.gz . """) stash includes: 'insttree.tar.gz', name: 'build' @@ -55,6 +55,7 @@ cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { rmdir insttree cosa fetch cosa build + cosa osbuild metal4k """) } // The e2e-adopt test will use the ostree commit we just generated above diff --git a/src/efi.rs b/src/efi.rs index 1adc3d63..b8fc24c3 100644 --- a/src/efi.rs +++ b/src/efi.rs @@ -345,14 +345,22 @@ impl Component for Efi { let srcdir_name = component_updatedirname(self); let ft = crate::filetree::FileTree::new_from_dir(&src_root.sub_dir(&srcdir_name)?)?; - // Using `blockdev` to find the partition instead of partlabel because - // we know the target install toplevel device already. - let esp_device = blockdev::get_esp_partition(device)? - .ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?; - - let destpath = &self.ensure_mounted_esp(Path::new(dest_root), Path::new(&esp_device))?; + // Let's attempt to use an already mounted ESP at the target + // dest_root if one is already mounted there in a known ESP location. + let destpath = if let Some(destdir) = self.get_mounted_esp(Path::new(dest_root))? { + destdir + } else { + // Using `blockdev` to find the partition instead of partlabel because + // we know the target install toplevel device already. + if device.is_empty() { + anyhow::bail!("Device value not provided"); + } + let esp_device = blockdev::get_esp_partition(device)? + .ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?; + self.mount_esp_device(Path::new(dest_root), Path::new(&esp_device))? + }; - let destd = &openat::Dir::open(destpath) + let destd = &openat::Dir::open(&destpath) .with_context(|| format!("opening dest dir {}", destpath.display()))?; validate_esp_fstype(destd)?;