Skip to content

Commit

Permalink
Don't mount input read-only if it's the same as output in sign_efi_bi…
Browse files Browse the repository at this point in the history
…nary()

Otherwise the output file cannot be written.

Replaces #3573
  • Loading branch information
DaanDeMeyer committed Mar 3, 2025
1 parent b4b9509 commit e050237
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mkosi/bootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,14 @@ def sign_efi_binary(context: Context, input: Path, output: Path) -> Path:
):
assert sbsign

options = ["--bind", output.parent, workdir(output.parent)]
if input != output:
options += ["--ro-bind", input, workdir(input)]

run_systemd_sign_tool(
context.config,
cmdline=[sbsign, "sign", "--output", workdir(output), workdir(input)],
options=["--ro-bind", input, workdir(input), "--bind", output.parent, workdir(output.parent)],
options=options,
certificate=context.config.secure_boot_certificate,
certificate_source=context.config.secure_boot_certificate_source,
key=context.config.secure_boot_key,
Expand All @@ -527,9 +531,11 @@ def sign_efi_binary(context: Context, input: Path, output: Path) -> Path:
] # fmt: skip
options = [
"--ro-bind", context.config.secure_boot_certificate, workdir(context.config.secure_boot_certificate), # noqa: E501
"--ro-bind", input, workdir(input),
"--bind", output.parent, workdir(output.parent),
] # fmt: skip
if input != output:
options += ["--ro-bind", input, workdir(input)]

if context.config.secure_boot_key_source.type == KeySourceType.engine:
cmd += ["--engine", context.config.secure_boot_key_source.source]
options += ["--bind", "/run", "/run"]
Expand Down

0 comments on commit e050237

Please sign in to comment.