boot/loader/systemd-boot: BootSpec makes initrdSecrets optional
A bootspec could remove the `initrdSecrets` attribute and is a perfectly valid bootspec, as can be seen in the bootspec.cue. This makes the builder not fail upon missing `initrdSecrets`.
This commit is contained in:
@@ -20,13 +20,13 @@ from dataclasses import dataclass
|
|||||||
class BootSpec:
|
class BootSpec:
|
||||||
init: str
|
init: str
|
||||||
initrd: str
|
initrd: str
|
||||||
initrdSecrets: str
|
|
||||||
kernel: str
|
kernel: str
|
||||||
kernelParams: List[str]
|
kernelParams: List[str]
|
||||||
label: str
|
label: str
|
||||||
system: str
|
system: str
|
||||||
toplevel: str
|
toplevel: str
|
||||||
specialisations: Dict[str, "BootSpec"]
|
specialisations: Dict[str, "BootSpec"]
|
||||||
|
initrdSecrets: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -131,9 +131,8 @@ def write_entry(profile: str | None, generation: int, specialisation: str | None
|
|||||||
specialisation=" (%s)" % specialisation if specialisation else "")
|
specialisation=" (%s)" % specialisation if specialisation else "")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([bootspec.initrdSecrets, "@efiSysMountPoint@%s" % (initrd)])
|
if bootspec.initrdSecrets is not None:
|
||||||
except FileNotFoundError:
|
subprocess.check_call([bootspec.initrdSecrets, "@efiSysMountPoint@%s" % (initrd)])
|
||||||
pass
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
if current:
|
if current:
|
||||||
print("failed to create initrd secrets!", file=sys.stderr)
|
print("failed to create initrd secrets!", file=sys.stderr)
|
||||||
|
|||||||
Reference in New Issue
Block a user