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:
parent
51d4de8c5b
commit
b3d998e7ea
1 changed files with 3 additions and 4 deletions
|
@ -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:
|
||||||
|
if bootspec.initrdSecrets is not None:
|
||||||
subprocess.check_call([bootspec.initrdSecrets, "@efiSysMountPoint@%s" % (initrd)])
|
subprocess.check_call([bootspec.initrdSecrets, "@efiSysMountPoint@%s" % (initrd)])
|
||||||
except FileNotFoundError:
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue