]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Default to UTC timezone if we can't figure out the local one
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 17 Mar 2024 16:14:10 +0000 (17:14 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 18 Mar 2024 08:19:39 +0000 (09:19 +0100)
mkosi/config.py

index 390699d3170bf7df2cd592101f87256fec34ca08..54ebd00d8b2bdd5ef1ebda852ec2e5dfa9f03f52 100644 (file)
@@ -3392,14 +3392,17 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]:
 
     creds |= args.credentials
 
-    if "firstboot.timezone" not in creds and find_binary("timedatectl"):
-        tz = run(
-            ["timedatectl", "show", "-p", "Timezone", "--value"],
-            stdout=subprocess.PIPE,
-            check=False,
-        ).stdout.strip()
-        if tz:
-            creds["firstboot.timezone"] = tz
+    if "firstboot.timezone" not in creds:
+        if find_binary("timedatectl"):
+            tz = run(
+                ["timedatectl", "show", "-p", "Timezone", "--value"],
+                stdout=subprocess.PIPE,
+                check=False,
+            ).stdout.strip()
+        else:
+            tz = "UTC"
+
+        creds["firstboot.timezone"] = tz
 
     if "firstboot.locale" not in creds:
         creds["firstboot.locale"] = "C.UTF-8"