From: Daan De Meyer Date: Thu, 31 Oct 2024 11:40:30 +0000 (+0100) Subject: Pass through stdin to various signing tools if an engine is used X-Git-Tag: v25~194^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3157%2Fhead;p=thirdparty%2Fmkosi.git Pass through stdin to various signing tools if an engine is used The engine might have a pin that needs to be entered via stdin so let's pass through stdin if that's the case so that users can enter the pin. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index bae8baa49..513d0f29b 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1551,6 +1551,11 @@ def run_ukify( run( cmd, + stdin=( + sys.stdin + if context.config.secure_boot_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), sandbox=context.sandbox( binary=ukify, options=[*opt, *options], @@ -3105,6 +3110,11 @@ def make_image( output = json.loads( run( cmdline, + stdin=( + sys.stdin + if context.config.verity_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), stdout=subprocess.PIPE, env=context.config.environment, sandbox=context.sandbox( @@ -3428,6 +3438,11 @@ def make_extension_image(context: Context, output: Path) -> None: j = json.loads( run( cmdline, + stdin=( + sys.stdin + if context.config.verity_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), stdout=subprocess.PIPE, env=context.config.environment, sandbox=context.sandbox( diff --git a/mkosi/bootloader.py b/mkosi/bootloader.py index ff2ed0d1f..8a1c37500 100644 --- a/mkosi/bootloader.py +++ b/mkosi/bootloader.py @@ -527,6 +527,11 @@ def sign_efi_binary(context: Context, input: Path, output: Path) -> Path: cmd += [workdir(input)] run( cmd, + stdin=( + sys.stdin + if context.config.secure_boot_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), sandbox=context.sandbox( binary="sbsign", options=options, @@ -549,6 +554,11 @@ def sign_efi_binary(context: Context, input: Path, output: Path) -> Path: "--in", workdir(input), "--out", workdir(output), ], + stdin=( + sys.stdin + if context.config.secure_boot_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), sandbox=context.sandbox( binary="pesign", options=[ @@ -764,6 +774,11 @@ def install_systemd_boot(context: Context) -> None: cmd += [db, workdir(context.workspace / "mkosi.esl")] run( cmd, + stdin=( + sys.stdin + if context.config.secure_boot_key_source.type != KeySourceType.file + else subprocess.DEVNULL + ), sandbox=context.sandbox( binary="sbvarsign", options=options,