From 010f6eaf9711d7c77c64d98d53c95247d84fcfaa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 26 Apr 2022 15:07:12 +0200 Subject: Added a NTP status check before processing to installation. (#1086) --- examples/guided.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index d7694e11..2009b315 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -151,6 +151,25 @@ def perform_installation(mountpoint): while archinstall.service_state('reflector') not in ('dead', 'failed'): time.sleep(1) + # If we've activated NTP, make sure at least one time-sync finishes + # before we continue with the installation + if archinstall.arguments.get('ntp', False): + # TODO: First block might be redundant, but this service is not activated unless + # `timedatectl set-ntp true` is executed. + logged = False + while archinstall.service_state('dbus-org.freedesktop.timesync1.service') not in ('running'): + if not logged: + installation.log(f"Waiting for dbus-org.freedesktop.timesync1.service to enter running state", level=logging.INFO) + logged = True + time.sleep(1) + + logged = False + while 'Server: n/a' in archinstall.SysCommand('timedatectl timesync-status --no-pager --property=Server --value'): + if not logged: + installation.log(f"Waiting for timedatectl timesync-status to report a timesync against a server", level=logging.INFO) + logged = True + time.sleep(1) + # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium -- cgit v1.2.3-54-g00ecf