Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions archinstall/lib/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from archinstall.lib.crypt import encrypt
from archinstall.lib.menu.helpers import Confirmation, Selection
from archinstall.lib.menu.util import get_password, prompt_dir
from archinstall.lib.models.bootloader import Bootloader
from archinstall.lib.models.network import NetworkConfiguration
from archinstall.lib.output import debug, logger, warn
from archinstall.lib.translationhandler import tr
from archinstall.tui.ui.menu_item import MenuItem, MenuItemGroup
Expand Down Expand Up @@ -58,6 +60,70 @@ def write_debug(self) -> None:
debug(' -- Chosen configuration --')
debug(self.user_config_to_json())

def as_summary(self) -> str:
"""
Render a concise two-column summary of the current configuration.

The left column holds section labels, the right column holds values.
Column width adapts to the longest translated label so translations
do not break the alignment. Rows whose underlying config is not set
are skipped.

Returns an empty string if nothing meaningful to show.
"""
rows: list[tuple[str, str]] = []

disk_config = self._config.disk_config
if disk_config and disk_config.device_modifications:
disk_parts: list[str] = []
for mod in disk_config.device_modifications:
path = str(mod.device_path)
root_part = mod.get_root_partition()
flags: list[str] = []
if root_part and root_part.fs_type:
flags.append(root_part.fs_type.value)
if disk_config.disk_encryption:
flags.append(tr('LUKS'))
disk_parts.append(f'{path} ({" + ".join(flags)})' if flags else path)
rows.append((tr('Disks'), ', '.join(disk_parts)))

bl_config = self._config.bootloader_config
if bl_config and bl_config.bootloader != Bootloader.NO_BOOTLOADER:
rows.append((tr('Bootloader'), bl_config.bootloader.value))

kernels = self._config.kernels
if kernels:
rows.append((tr('Kernel'), ', '.join(kernels)))

profile_config = self._config.profile_config
if profile_config and profile_config.profile:
names = profile_config.profile.current_selection_names()
rows.append((tr('Profile'), ', '.join(names) if names else profile_config.profile.name))
if profile_config.greeter:
rows.append((tr('Greeter'), profile_config.greeter.value))

packages = self._config.packages
if packages:
rows.append((tr('Packages'), str(len(packages))))

net_config = self._config.network_config
if isinstance(net_config, NetworkConfiguration):
rows.append((tr('Network'), net_config.type.display_msg()))

locale_config = self._config.locale_config
if locale_config:
rows.append((tr('Locale'), locale_config.sys_lang))

tz = self._config.timezone
if tz:
rows.append((tr('Timezone'), tz))

if not rows:
return ''

label_width = max(len(label) for label, _ in rows) + 2
return '\n'.join(f'{label:<{label_width}}{value}' for label, value in rows)

async def confirm_config(self) -> bool:
header = f'{tr("The specified configuration will be applied")}. '
header += tr('Would you like to continue?') + '\n'
Expand Down
8 changes: 6 additions & 2 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from archinstall.lib.authentication.authentication_menu import AuthenticationMenu
from archinstall.lib.bootloader.bootloader_menu import BootloaderMenu
from archinstall.lib.bootloader.utils import validate_bootloader_layout
from archinstall.lib.configuration import save_config
from archinstall.lib.configuration import ConfigurationOutput, save_config
from archinstall.lib.disk.disk_menu import DiskLayoutConfigurationMenu
from archinstall.lib.general.general_menu import select_hostname, select_ntp, select_timezone
from archinstall.lib.general.system_menu import select_kernel, select_swap
Expand Down Expand Up @@ -508,7 +508,11 @@ def _prev_install_invalid_config(self, item: MenuItem) -> str | None:
if error := self._validate_bootloader():
return tr(f'Invalid configuration: {error}')

return None
self.sync_all_to_config()
summary = ConfigurationOutput(self._arch_config).as_summary()
if summary:
return f'{tr("Ready to install")}\n\n{summary}'
Comment thread
Softer marked this conversation as resolved.
return tr('Ready to install')

def _prev_profile(self, item: MenuItem) -> str | None:
profile_config: ProfileConfiguration | None = item.value
Expand Down
15 changes: 15 additions & 0 deletions archinstall/locales/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,21 @@ msgstr ""
msgid "Invalid configuration: {error}"
msgstr ""

msgid "Ready to install"
msgstr ""

msgid "Disks"
msgstr ""

msgid "Packages"
msgstr ""

msgid "Network"
msgstr ""

msgid "Locale"
msgstr ""

msgid "Type"
msgstr ""

Expand Down
15 changes: 15 additions & 0 deletions archinstall/locales/uk/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,21 @@ msgstr "Модель"
msgid "Invalid configuration: {error}"
msgstr "Неправильна конфігурація: {error}"

msgid "Ready to install"
msgstr "Готово до встановлення"

msgid "Disks"
msgstr "Диски"

msgid "Packages"
msgstr "Пакети"

msgid "Network"
msgstr "Мережа"

msgid "Locale"
msgstr "Локаль"

msgid "Type"
msgstr "Тип"

Expand Down