Skip to content

Commit 2fa1368

Browse files
authored
Merge pull request #382 from nix-community/logs
fix(tool): better error if public key is missing
2 parents 9f04412 + 8b848c3 commit 2fa1368

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rust/tool/systemd/src/install.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<S: Signer> Installer<S> {
160160
// The kernels and initrds are content-addressed.
161161
// Thus, this cannot overwrite files of old generation with different content.
162162
self.install_generation(&generation)
163-
.context("Failed to install generation.")?;
163+
.with_context(|| format!("Failed to install generation {}", generation.version))?;
164164
for (name, bootspec) in &generation.spec.bootspec.specialisations {
165165
let specialised_generation = generation.specialise(name, bootspec);
166166
self.install_generation(&specialised_generation)
@@ -264,7 +264,7 @@ impl<S: Signer> Installer<S> {
264264
let stub_target = self
265265
.esp_paths
266266
.linux
267-
.join(stub_name(generation, &self.signer)?);
267+
.join(stub_name(generation, &self.signer).context("Get stub name")?);
268268
self.gc_roots.extend([&stub_target]);
269269
install_signed(&self.signer, &lanzaboote_image_path, &stub_target)
270270
.context("Failed to install the Lanzaboote stub.")?;
@@ -279,8 +279,9 @@ impl<S: Signer> Installer<S> {
279279
let stub_target = self
280280
.esp_paths
281281
.linux
282-
.join(stub_name(generation, &self.signer)?);
283-
let stub = fs::read(&stub_target)?;
282+
.join(stub_name(generation, &self.signer).context("While getting stub name")?);
283+
let stub = fs::read(&stub_target)
284+
.with_context(|| format!("Failed to read the stub: {}", stub_target.display()))?;
284285
let kernel_path = resolve_efi_path(
285286
&self.esp_paths.esp,
286287
pe::read_section_data(&stub, ".linux").context("Missing kernel path.")?,

0 commit comments

Comments
 (0)