]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: Fix tools detection if --tools was not passed
authorJan Janssen <medhefgo@web.de>
Tue, 10 Jan 2023 14:13:22 +0000 (15:13 +0100)
committerJan Janssen <medhefgo@web.de>
Wed, 11 Jan 2023 08:29:41 +0000 (09:29 +0100)
In 789a642738d28cf2a8ad3f65df9c0c136e83af09 llvm-objcopy was given
higher priority over objcopy, but this would only work if --tools was
also passed.

src/ukify/ukify.py

index 2827eadbb60a2d57abf896de7eb71081d003846d..296521aa56eb17b73b5cd54c97762ab0960e1fa4 100755 (executable)
@@ -16,6 +16,7 @@ import os
 import pathlib
 import re
 import shlex
+import shutil
 import subprocess
 import tempfile
 import typing
@@ -341,7 +342,10 @@ def find_tool(name, fallback=None, opts=None):
             if tool.exists():
                 return tool
 
-    return fallback or name
+    if shutil.which(name) is not None:
+        return name
+
+    return fallback
 
 
 def combine_signatures(pcrsigs):