Remove arch_config_handler from installer (#4246)

This commit is contained in:
codefiles 2026-02-18 15:18:53 -05:00 committed by GitHub
parent bd35473b5d
commit 618c0bd5dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 9 deletions

View File

@ -42,7 +42,6 @@ from archinstall.lib.models.packages import Repository
from archinstall.lib.packages.packages import installed_package from archinstall.lib.packages.packages import installed_package
from archinstall.lib.translationhandler import tr from archinstall.lib.translationhandler import tr
from .args import arch_config_handler
from .boot import Boot from .boot import Boot
from .command import SysCommand, run from .command import SysCommand, run
from .exceptions import DiskError, HardwareIncompatibilityError, RequirementError, ServiceException, SysCallError from .exceptions import DiskError, HardwareIncompatibilityError, RequirementError, ServiceException, SysCallError
@ -74,6 +73,7 @@ class Installer:
disk_config: DiskLayoutConfiguration, disk_config: DiskLayoutConfiguration,
base_packages: list[str] = [], base_packages: list[str] = [],
kernels: list[str] | None = None, kernels: list[str] | None = None,
silent: bool = False,
): ):
""" """
`Installer()` is the wrapper for most basic installation steps. `Installer()` is the wrapper for most basic installation steps.
@ -126,7 +126,7 @@ class Installer:
self._zram_enabled = False self._zram_enabled = False
self._disable_fstrim = False self._disable_fstrim = False
self.pacman = Pacman(self.target, arch_config_handler.args.silent) self.pacman = Pacman(self.target, silent)
def __enter__(self) -> Self: def __enter__(self) -> Self:
return self return self
@ -176,14 +176,14 @@ class Installer:
if mod not in self._modules: if mod not in self._modules:
self._modules.append(mod) self._modules.append(mod)
def _verify_service_stop(self) -> None: def _verify_service_stop(self, offline: bool, skip_ntp: bool, skip_wkd: bool) -> None:
""" """
Certain services might be running that affects the system during installation. Certain services might be running that affects the system during installation.
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.
""" """
if not arch_config_handler.args.skip_ntp: if not skip_ntp:
info(tr('Waiting for time sync (timedatectl show) to complete.')) info(tr('Waiting for time sync (timedatectl show) to complete.'))
started_wait = time.time() started_wait = time.time()
@ -200,7 +200,7 @@ class Installer:
else: else:
info(tr('Skipping waiting for automatic time sync (this can cause issues if time is out of sync during installation)')) info(tr('Skipping waiting for automatic time sync (this can cause issues if time is out of sync during installation)'))
if not arch_config_handler.args.offline: if not offline:
info('Waiting for automatic mirror selection (reflector) to complete.') info('Waiting for automatic mirror selection (reflector) to complete.')
for _ in range(60): for _ in range(60):
if self._service_state('reflector') in ('dead', 'failed', 'exited'): if self._service_state('reflector') in ('dead', 'failed', 'exited'):
@ -215,7 +215,7 @@ class Installer:
# while self._service_state('pacman-init') not in ('dead', 'failed', 'exited'): # while self._service_state('pacman-init') not in ('dead', 'failed', 'exited'):
# time.sleep(1) # time.sleep(1)
if not arch_config_handler.args.skip_wkd: if not skip_wkd:
info(tr('Waiting for Arch Linux keyring sync (archlinux-keyring-wkd-sync) to complete.')) info(tr('Waiting for Arch Linux keyring sync (archlinux-keyring-wkd-sync) to complete.'))
# Wait for the timer to kick in # Wait for the timer to kick in
while self._service_started('archlinux-keyring-wkd-sync.timer') is None: while self._service_started('archlinux-keyring-wkd-sync.timer') is None:
@ -243,9 +243,14 @@ class Installer:
f'Please resize it to at least 200MiB and re-run the installation.', f'Please resize it to at least 200MiB and re-run the installation.',
) )
def sanity_check(self) -> None: def sanity_check(
self,
offline: bool = False,
skip_ntp: bool = False,
skip_wkd: bool = False,
) -> None:
# self._verify_boot_part() # self._verify_boot_part()
self._verify_service_stop() self._verify_service_stop(offline, skip_ntp, skip_wkd)
def mount_ordered_layout(self) -> None: def mount_ordered_layout(self) -> None:
debug('Mounting ordered layout') debug('Mounting ordered layout')

View File

@ -77,12 +77,17 @@ def perform_installation(
mountpoint, mountpoint,
disk_config, disk_config,
kernels=config.kernels, kernels=config.kernels,
silent=arch_config_handler.args.silent,
) as installation: ) as installation:
# Mount all the drives to the desired mountpoint # Mount all the drives to the desired mountpoint
if disk_config.config_type != DiskLayoutType.Pre_mount: if disk_config.config_type != DiskLayoutType.Pre_mount:
installation.mount_ordered_layout() installation.mount_ordered_layout()
installation.sanity_check() installation.sanity_check(
arch_config_handler.args.offline,
arch_config_handler.args.skip_ntp,
arch_config_handler.args.skip_wkd,
)
if disk_config.config_type != DiskLayoutType.Pre_mount: if disk_config.config_type != DiskLayoutType.Pre_mount:
if disk_config.disk_encryption and disk_config.disk_encryption.encryption_type != EncryptionType.NoEncryption: if disk_config.disk_encryption and disk_config.disk_encryption.encryption_type != EncryptionType.NoEncryption:

View File

@ -28,6 +28,7 @@ def perform_installation(mountpoint: Path) -> None:
mountpoint, mountpoint,
disk_config, disk_config,
kernels=config.kernels, kernels=config.kernels,
silent=arch_config_handler.args.silent,
) as installation: ) as installation:
# Strap in the base system, add a bootloader and configure # Strap in the base system, add a bootloader and configure
# some other minor details as specified by this profile and user. # some other minor details as specified by this profile and user.

View File

@ -40,6 +40,7 @@ def perform_installation(mountpoint: Path) -> None:
mountpoint, mountpoint,
disk_config, disk_config,
kernels=config.kernels, kernels=config.kernels,
silent=arch_config_handler.args.silent,
) as installation: ) as installation:
# Mount all the drives to the desired mountpoint # Mount all the drives to the desired mountpoint
# This *can* be done outside of the installation, but the installer can deal with it. # This *can* be done outside of the installation, but the installer can deal with it.