lanzatool: remove v1 key
This commit is contained in:
parent
521bf343f5
commit
d40b9f281c
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"v1": {
|
|
||||||
"init": "/run/current-system/init",
|
"init": "/run/current-system/init",
|
||||||
"initrd": "/run/current-system/initrd",
|
"initrd": "/run/current-system/initrd",
|
||||||
"kernel": "/run/current-system/kernel",
|
"kernel": "/run/current-system/kernel",
|
||||||
|
@ -22,4 +21,3 @@
|
||||||
"osRelease": "/etc/os-release"
|
"osRelease": "/etc/os-release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,14 +2,9 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
||||||
pub struct Bootspec {
|
|
||||||
pub v1: GenerationV1,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct GenerationV1 {
|
pub struct Bootspec {
|
||||||
/// Label for the system closure
|
/// Label for the system closure
|
||||||
pub label: String,
|
pub label: String,
|
||||||
/// Path to kernel (bzImage) -- $toplevel/kernel
|
/// Path to kernel (bzImage) -- $toplevel/kernel
|
||||||
|
|
|
@ -16,30 +16,29 @@ pub fn install(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let bootspec_doc: Bootspec = serde_json::from_slice(&fs::read(bootspec)?)?;
|
let bootspec_doc: Bootspec = serde_json::from_slice(&fs::read(bootspec)?)?;
|
||||||
|
|
||||||
let esp_paths = EspPaths::new(&bootspec_doc.v1.extension.esp);
|
let esp_paths = EspPaths::new(&bootspec_doc.extension.esp);
|
||||||
|
|
||||||
let lanzaboote_image = pe::assemble_image(
|
let lanzaboote_image = pe::assemble_image(
|
||||||
lanzaboote_stub,
|
lanzaboote_stub,
|
||||||
&bootspec_doc.v1.extension.os_release,
|
&bootspec_doc.extension.os_release,
|
||||||
&bootspec_doc.v1.kernel_params,
|
&bootspec_doc.kernel_params,
|
||||||
&esp_paths.kernel,
|
&esp_paths.kernel,
|
||||||
&esp_paths.initrd,
|
&esp_paths.initrd,
|
||||||
)
|
)
|
||||||
.expect("Failed to assemble stub");
|
.expect("Failed to assemble stub");
|
||||||
|
|
||||||
let wrapped_initrd =
|
let wrapped_initrd =
|
||||||
pe::wrap_initrd(initrd_stub, &bootspec_doc.v1.initrd).expect("Failed to assemble stub");
|
pe::wrap_initrd(initrd_stub, &bootspec_doc.initrd).expect("Failed to assemble stub");
|
||||||
|
|
||||||
// Copy the files to the ESP
|
// Copy the files to the ESP
|
||||||
fs::create_dir_all(&esp_paths.nixos)?;
|
fs::create_dir_all(&esp_paths.nixos)?;
|
||||||
fs::copy(bootspec_doc.v1.kernel, esp_paths.kernel)?;
|
fs::copy(bootspec_doc.kernel, esp_paths.kernel)?;
|
||||||
fs::copy(wrapped_initrd, esp_paths.initrd)?;
|
fs::copy(wrapped_initrd, esp_paths.initrd)?;
|
||||||
|
|
||||||
fs::create_dir_all(&esp_paths.linux)?;
|
fs::create_dir_all(&esp_paths.linux)?;
|
||||||
fs::copy(lanzaboote_image, esp_paths.lanzaboote_image)?;
|
fs::copy(lanzaboote_image, esp_paths.lanzaboote_image)?;
|
||||||
|
|
||||||
let systemd_boot = bootspec_doc
|
let systemd_boot = bootspec_doc
|
||||||
.v1
|
|
||||||
.extension
|
.extension
|
||||||
.systemd
|
.systemd
|
||||||
.join("lib/systemd/boot/efi/systemd-bootx64.efi");
|
.join("lib/systemd/boot/efi/systemd-bootx64.efi");
|
||||||
|
|
Loading…
Reference in New Issue