From: Daan De Meyer Date: Fri, 15 Jul 2022 00:37:48 +0000 (+0200) Subject: Only pass arguments to build script when verb is "build" X-Git-Tag: v14~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3103a6d275fe2c2bb5e38dab4c1030339cd56881;p=thirdparty%2Fmkosi.git Only pass arguments to build script when verb is "build" When we're building the image because it's required for another verb, any passed arguments are most likely intended for the target verb, and not for "build", so don't add them in that case. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index eb2b799d0..319e6386c 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -7382,7 +7382,11 @@ def run_build_script(args: MkosiArgs, root: Path, raw: Optional[BinaryIO]) -> No cmdline += ["--keep-unit"] cmdline += [f"/root/{args.build_script.name}"] - cmdline += args.cmdline + + # When we're building the image because it's required for another verb, any passed arguments are most + # likely intended for the target verb, and not for "build", so don't add them in that case. + if args.verb == Verb.build: + cmdline += args.cmdline # build-script output goes to stdout so we can run language servers from within mkosi build-scripts. # See https://github.com/systemd/mkosi/pull/566 for more information.