Skip to content

Commit 5dad068

Browse files
committed
[DO NOT MERGE] fix: do not emit a temporary initrd location if it's not needed
We should wait on the upstream PR to be merged so we can get rid of the flake reference.
1 parent 2c46efc commit 5dad068

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Secure Boot for NixOS";
33

44
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
5+
nixpkgs.url = "github:RaitoBezarius/nixpkgs/initrd-secrets";
66

77
flake-parts.url = "github:hercules-ci/flake-parts";
88
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";

rust/tool/systemd/src/install.rs

+20-10
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,27 @@ impl<S: LanzabooteSigner> Installer<S> {
210210
.context("Failed to install the kernel.")?;
211211

212212
// Assemble and install the initrd, and record its path on the ESP.
213-
let initrd_location = tempdir
214-
.write_secure_file(
215-
fs::read(
216-
bootspec
217-
.initrd
218-
.as_ref()
219-
.context("Lanzaboote does not support missing initrd yet.")?,
213+
// It is not needed to write the initrd in a temporary directory
214+
// if we do not have any initrd secret.
215+
let initrd_location = if bootspec.initrd_secrets.is_some() {
216+
tempdir
217+
.write_secure_file(
218+
fs::read(
219+
bootspec
220+
.initrd
221+
.as_ref()
222+
.context("Lanzaboote does not support missing initrd yet.")?,
223+
)
224+
.context("Failed to read the initrd.")?,
220225
)
221-
.context("Failed to read the initrd.")?,
222-
)
223-
.context("Failed to copy the initrd to the temporary directory.")?;
226+
.context("Failed to copy the initrd to the temporary directory.")?
227+
} else {
228+
bootspec
229+
.initrd
230+
.clone()
231+
.expect("Lanzaboote does not support missing initrd yet.")
232+
};
233+
224234
if let Some(initrd_secrets_script) = &bootspec.initrd_secrets {
225235
append_initrd_secrets(initrd_secrets_script, &initrd_location, generation.version)?;
226236
}

0 commit comments

Comments
 (0)