]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: Factor out sbat into constants 34641/head
authorJörg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 9 Oct 2024 10:06:32 +0000 (12:06 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 9 Oct 2024 10:11:57 +0000 (12:11 +0200)
src/ukify/ukify.py

index d3cb41398ee560019d4248c87dd4d20e94984b26..93ad78b01d1a7d297f2f5c60b3e0fb6035a167f2 100755 (executable)
@@ -871,6 +871,17 @@ def verify(tool: dict[str, str], opts: argparse.Namespace) -> bool:
     return tool['output'] in info
 
 
+STUB_SBAT = """\
+sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
+uki,1,UKI,uki,1,https://uapi-group.org/specifications/specs/unified_kernel_image/
+"""
+
+ADDON_SBAT = """\
+sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
+uki-addon,1,UKI Addon,addon,1,https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html
+"""
+
+
 def make_uki(opts: argparse.Namespace) -> None:
     # kernel payload signing
 
@@ -979,20 +990,12 @@ def make_uki(opts: argparse.Namespace) -> None:
             # either.
             input_pes = [opts.stub, linux]
             if not opts.sbat:
-                opts.sbat = [
-                    """sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
-uki,1,UKI,uki,1,https://uapi-group.org/specifications/specs/unified_kernel_image/
-"""
-                ]
+                opts.sbat = [STUB_SBAT]
         else:
             # Addons don't use the stub so we add SBAT manually
             input_pes = []
             if not opts.sbat:
-                opts.sbat = [
-                    """sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
-uki-addon,1,UKI Addon,addon,1,https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html
-"""
-                ]
+                opts.sbat = [ADDON_SBAT]
         uki.add_section(Section.create('.sbat', merge_sbat(input_pes, opts.sbat), measure=linux is not None))
 
     # If we're building a UKI with additional profiles, the .profile section for the base profile has to be