From f211906a5afcfad553070748a779c3166d2b3b4b Mon Sep 17 00:00:00 2001 From: Daemon Coder <11915375+codefiles@users.noreply.github.com> Date: Thu, 4 May 2023 10:04:35 -0400 Subject: Remove obsolete enabling of NTP in ISO (#1729) * Remove obsolete enabling of NTP in ISO * Fixed flake8 linting * Remove `activate_ntp()` * Update comment --------- Co-authored-by: Anton Hvornum --- archinstall/lib/global_menu.py | 12 +----------- archinstall/lib/installer.py | 28 ++++++---------------------- 2 files changed, 7 insertions(+), 33 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index bc9164ee..0ec057f3 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any, List, Optional, Union, Dict, TYPE_CHECKING from . import disk -from .general import SysCommand, secret +from .general import secret from .menu import Selector, AbstractMenu from .models import NetworkConfiguration from .models.bootloader import Bootloader @@ -18,7 +18,6 @@ from .user_interaction import ask_for_audio_selection from .user_interaction import ask_for_bootloader from .user_interaction import ask_for_swap from .user_interaction import ask_hostname -from .user_interaction import ask_ntp from .user_interaction import ask_to_configure_network from .user_interaction import get_password, ask_for_a_timezone from .user_interaction import select_additional_repositories @@ -164,7 +163,6 @@ class GlobalMenu(AbstractMenu): self._menu_options['ntp'] = \ Selector( _('Automatic time sync (NTP)'), - lambda preset: self._select_ntp(preset), default=True) self._menu_options['__separator__'] = \ Selector('') @@ -323,14 +321,6 @@ class GlobalMenu(AbstractMenu): password = get_password(prompt=prompt) return password - def _select_ntp(self, preset :bool = True) -> bool: - ntp = ask_ntp(preset) - - value = str(ntp).lower() - SysCommand(f'timedatectl set-ntp {value}') - - return ntp - def _select_disk_config( self, preset: Optional[disk.DiskLayoutConfiguration] = None diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c51019fd..726ff3d0 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -162,10 +162,14 @@ class Installer: def _verify_service_stop(self): """ Certain services might be running that affects the system during installation. - Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist + One such service is "reflector.service" which updates /etc/pacman.d/mirrorlist We need to wait for it before we continue since we opted in to use a custom mirror/region. """ - log('Waiting for automatic mirror selection (reflector) to complete...', level=logging.INFO) + log('Waiting for time sync (systemd-timesyncd.service) to complete.', level=logging.INFO) + while SysCommand('timedatectl show --property=NTPSynchronized --value').decode().rstrip() != 'yes': + time.sleep(1) + + log('Waiting for automatic mirror selection (reflector) to complete.', level=logging.INFO) while service_state('reflector') not in ('dead', 'failed', 'exited'): time.sleep(1) @@ -282,26 +286,6 @@ class Installer: self._disk_encryption.encryption_password ) - def activate_ntp(self): - """ - If NTP is activated, confirm activiation in the ISO and at least one time-sync finishes - """ - SysCommand('timedatectl set-ntp true') - - logged = False - while service_state('dbus-org.freedesktop.timesync1.service') not in ['running']: - if not logged: - 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 SysCommand('timedatectl timesync-status --no-pager --property=Server --value'): - if not logged: - log(f"Waiting for timedatectl timesync-status to report a timesync against a server", level=logging.INFO) - logged = True - time.sleep(1) - def sync_log_to_install_medium(self) -> bool: # Copy over the install log (if there is one) to the install medium if # at least the base has been strapped in, otherwise we won't have a filesystem/structure to copy to. -- cgit v1.2.3-54-g00ecf