From: Daan De Meyer Date: Sun, 17 Mar 2024 16:14:10 +0000 (+0100) Subject: Default to UTC timezone if we can't figure out the local one X-Git-Tag: v23~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccc5b644340bf8e83d90414b798f04352cf92b25;p=thirdparty%2Fmkosi.git Default to UTC timezone if we can't figure out the local one --- diff --git a/mkosi/config.py b/mkosi/config.py index 390699d31..54ebd00d8 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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"