f.write("fi\n")
-def expand_kernel_specifiers(text: str, kver: str, token: str, roothash: str, boot_count: str) -> str:
+def expand_kernel_specifiers(text: str, kver: str, token: str, roothash: str) -> str:
specifiers = {
"&": "&",
"e": token,
"k": kver,
"h": roothash,
- "c": boot_count,
}
return expand_delayed_specifiers(specifiers, text)
if not context.config.unified_kernel_image_format:
bootloader_entry_format += "-&h"
- boot_count = ""
- if (context.root / "etc/kernel/tries").exists():
- boot_count = (context.root / "etc/kernel/tries").read_text().strip()
-
- if not context.config.unified_kernel_image_format:
- bootloader_entry_format += "+&c"
-
return expand_kernel_specifiers(
bootloader_entry_format,
kver=kver,
token=token,
roothash=roothash_value,
- boot_count=boot_count,
)
"requires a filename with no path components."
),
# The default value is set in `__init__.py` in `install_uki`.
- # `None` is used to determine if the roothash and boot count format
- # should be appended to the filename if they are found.
+ # `None` is used to determine if the roothash should be appended
+ # to the filename if they are found.
# default=
help="Specify the format used for the UKI filename",
),
| `&e` | Entry Token |
| `&k` | Kernel version |
| `&h` | `roothash=` or `usrhash=` value of kernel argument |
- | `&c` | Number of tries used for boot attempt counting |
`UnifiedKernelImageProfiles=`, `--uki-profile=`
: Build additional UKI profiles. Takes a comma-separated list of paths
kver = "13.0.8-5.10.0-1057-oem" # taken from reporter of #1638
token = "MySystemImage"
roothash = "67e893261799236dcf20529115ba9fae4fd7c2269e1e658d42269503e5760d38"
- boot_count = "3"
def test_expand_kernel_specifiers(text: str) -> str:
return expand_kernel_specifiers(
kver=kver,
token=token,
roothash=roothash,
- boot_count=boot_count,
)
assert test_expand_kernel_specifiers("&&") == "&"
assert test_expand_kernel_specifiers("&k") == kver
assert test_expand_kernel_specifiers("&e") == token
assert test_expand_kernel_specifiers("&h") == roothash
- assert test_expand_kernel_specifiers("&c") == boot_count
assert test_expand_kernel_specifiers("Image_1.0.3") == "Image_1.0.3"
- assert (
- test_expand_kernel_specifiers("Image~&c+&h-&k-&e") == f"Image~{boot_count}+{roothash}-{kver}-{token}"
- )
+ assert test_expand_kernel_specifiers("Image+&h-&k-&e") == f"Image+{roothash}-{kver}-{token}"
def test_output_id_version(tmp_path: Path) -> None: