]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't try to tun timedatectl or ssh-add if not available
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Aug 2023 09:54:25 +0000 (11:54 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Aug 2023 09:54:25 +0000 (11:54 +0200)
mkosi/config.py

index 8d4fbe8565fc92fd0db43e5e72a55caa4149018d..529ffa520d4a6895f7a151c83e9c35ad326ad9da 100644 (file)
@@ -1938,7 +1938,7 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]:
         key, _, value = s.partition("=")
         creds[key] = value
 
-    if "firstboot.timezone" not in creds:
+    if "firstboot.timezone" not in creds and shutil.which("timedatectl"):
         tz = run(
             ["timedatectl", "show", "-p", "Timezone", "--value"],
             stdout=subprocess.PIPE,
@@ -1950,7 +1950,7 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]:
     if "firstboot.locale" not in creds:
         creds["firstboot.locale"] = "C.UTF-8"
 
-    if args.ssh and "ssh.authorized_keys.root" not in creds and "SSH_AUTH_SOCK" in os.environ:
+    if args.ssh and "ssh.authorized_keys.root" not in creds and "SSH_AUTH_SOCK" in os.environ and shutil.which("ssh-add"):
         key = run(
             ["ssh-add", "-L"],
             stdout=subprocess.PIPE,