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 <anton@hvornum.se>
This commit is contained in:
Daemon Coder 2023-05-04 10:04:35 -04:00 committed by GitHub
parent fd83f073f3
commit f211906a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 45 deletions

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Any, List, Optional, Union, Dict, TYPE_CHECKING from typing import Any, List, Optional, Union, Dict, TYPE_CHECKING
from . import disk from . import disk
from .general import SysCommand, secret from .general import secret
from .menu import Selector, AbstractMenu from .menu import Selector, AbstractMenu
from .models import NetworkConfiguration from .models import NetworkConfiguration
from .models.bootloader import Bootloader 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_bootloader
from .user_interaction import ask_for_swap from .user_interaction import ask_for_swap
from .user_interaction import ask_hostname from .user_interaction import ask_hostname
from .user_interaction import ask_ntp
from .user_interaction import ask_to_configure_network from .user_interaction import ask_to_configure_network
from .user_interaction import get_password, ask_for_a_timezone from .user_interaction import get_password, ask_for_a_timezone
from .user_interaction import select_additional_repositories from .user_interaction import select_additional_repositories
@ -164,7 +163,6 @@ class GlobalMenu(AbstractMenu):
self._menu_options['ntp'] = \ self._menu_options['ntp'] = \
Selector( Selector(
_('Automatic time sync (NTP)'), _('Automatic time sync (NTP)'),
lambda preset: self._select_ntp(preset),
default=True) default=True)
self._menu_options['__separator__'] = \ self._menu_options['__separator__'] = \
Selector('') Selector('')
@ -323,14 +321,6 @@ class GlobalMenu(AbstractMenu):
password = get_password(prompt=prompt) password = get_password(prompt=prompt)
return password 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( def _select_disk_config(
self, self,
preset: Optional[disk.DiskLayoutConfiguration] = None preset: Optional[disk.DiskLayoutConfiguration] = None

View File

@ -162,10 +162,14 @@ class Installer:
def _verify_service_stop(self): def _verify_service_stop(self):
""" """
Certain services might be running that affects the system during installation. 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. 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'): while service_state('reflector') not in ('dead', 'failed', 'exited'):
time.sleep(1) time.sleep(1)
@ -282,26 +286,6 @@ class Installer:
self._disk_encryption.encryption_password 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: def sync_log_to_install_medium(self) -> bool:
# Copy over the install log (if there is one) to the install medium if # 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. # at least the base has been strapped in, otherwise we won't have a filesystem/structure to copy to.

View File

@ -149,9 +149,6 @@ def perform_installation(mountpoint: Path):
# generate encryption key files for the mounted luks devices # generate encryption key files for the mounted luks devices
installation.generate_key_files() installation.generate_key_files()
if archinstall.arguments.get('ntp', False):
installation.activate_ntp()
# Set mirrors used by pacstrap (outside of installation) # Set mirrors used by pacstrap (outside of installation)
if archinstall.arguments.get('mirror-region', None): if archinstall.arguments.get('mirror-region', None):
use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium

View File

@ -74,9 +74,6 @@ class SetupMenu(GlobalMenu):
self.enable('abort') self.enable('abort')
def exit_callback(self): def exit_callback(self):
if self._data_store.get('ntp', False):
archinstall.SysCommand('timedatectl set-ntp true')
if self._data_store.get('mode', None): if self._data_store.get('mode', None):
archinstall.arguments['mode'] = self._data_store['mode'] archinstall.arguments['mode'] = self._data_store['mode']
log(f"Archinstall will execute under {archinstall.arguments['mode']} mode") log(f"Archinstall will execute under {archinstall.arguments['mode']} mode")
@ -203,9 +200,6 @@ def perform_installation(mountpoint: Path, exec_mode: ExecutionMode):
# generate encryption key files for the mounted luks devices # generate encryption key files for the mounted luks devices
installation.generate_key_files() installation.generate_key_files()
if archinstall.arguments.get('ntp', False):
installation.activate_ntp()
# Set mirrors used by pacstrap (outside of installation) # Set mirrors used by pacstrap (outside of installation)
if archinstall.arguments.get('mirror-region', None): if archinstall.arguments.get('mirror-region', None):
use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium

View File

@ -112,9 +112,6 @@ def perform_installation(mountpoint: Path):
# generate encryption key files for the mounted luks devices # generate encryption key files for the mounted luks devices
installation.generate_key_files() installation.generate_key_files()
if archinstall.arguments.get('ntp', False):
installation.activate_ntp()
# Set mirrors used by pacstrap (outside of installation) # Set mirrors used by pacstrap (outside of installation)
if archinstall.arguments.get('mirror-region', None): if archinstall.arguments.get('mirror-region', None):
use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium