Skip to content

Commit cb0f3a6

Browse files
authored
Warn when no network configuration is selected (#4408)
* Make network configuration mandatory with explicit "No network" option * Add network configuration recommendation hint and disable sorting * Warn when network selection was skipped instead of making it mandatory Replace the mandatory network_config menu requirement with a yellow warning on the final confirmation screen, shown only when the user skipped the network menu entirely. Explicitly picking "No network configuration" is treated as a conscious choice and does not trigger the warning. - Drop mandatory=True from the network_config global menu item - Rename NicType.NONE menu label from "No network" to "No network configuration" (an installed system still has an NIC; only the install-time configuration is absent) - Add ConfigurationOutput.get_install_warnings() and render them in confirm_config when show_install_warnings=True - guided.py and minimal.py enable the warning on the confirm screen - Reuse the existing "No network configuration" msgid in .pot; add the warning string; update Ukrainian translations accordingly * Drop NicType.NONE from this PR The NONE option introduced earlier in this branch is being removed per review feedback (#4408). Whether to add explicit "None" options across multiple menus (greeter, gfx driver, network, bootloader) is now being discussed in #4464 and should land as a separate change there. This PR keeps only the warning-on-confirm behaviour: when the user skipped the network menu entirely (network_config is None), a yellow warning is shown on the final confirmation screen.
1 parent 1b7a32a commit cb0f3a6

6 files changed

Lines changed: 41 additions & 5 deletions

File tree

archinstall/lib/configuration.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,13 @@ def as_summary(self) -> str:
124124
label_width = max(len(label) for label, _ in rows) + 2
125125
return '\n'.join(f'{label:<{label_width}}{value}' for label, value in rows)
126126

127-
async def confirm_config(self) -> bool:
127+
async def confirm_config(self, show_install_warnings: bool = False) -> bool:
128128
header = f'{tr("The specified configuration will be applied")}. '
129129
header += tr('Would you like to continue?') + '\n'
130130

131+
if show_install_warnings:
132+
header += self._render_install_warnings()
133+
131134
group = MenuItemGroup.yes_no()
132135
group.set_preview_for_all(lambda x: self.user_config_to_json())
133136

@@ -145,6 +148,22 @@ async def confirm_config(self) -> bool:
145148

146149
return True
147150

151+
def get_install_warnings(self) -> list[str]:
152+
warnings: list[str] = []
153+
154+
if not isinstance(self._config.network_config, NetworkConfiguration):
155+
warnings.append(tr('Warning: no network configuration selected. Network will need to be set up manually on the installed system.'))
156+
157+
return warnings
158+
159+
def _render_install_warnings(self) -> str:
160+
warnings = self.get_install_warnings()
161+
162+
if not warnings:
163+
return ''
164+
165+
return '\n' + '\n'.join(f'[yellow]{w}[/]' for w in warnings) + '\n'
166+
148167
def _is_valid_path(self, dest_path: Path) -> bool:
149168
dest_path_ok = dest_path.exists() and dest_path.is_dir()
150169
if not dest_path_ok:

archinstall/lib/network/network_menu.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,17 @@ async def select_network(preset: NetworkConfiguration | None) -> NetworkConfigur
172172
"""
173173

174174
items = [MenuItem(n.display_msg(), value=n) for n in NicType]
175-
group = MenuItemGroup(items, sort_items=True)
175+
group = MenuItemGroup(items, sort_items=False)
176176

177177
if preset:
178178
group.set_selected_by_value(preset.type)
179179

180+
header = tr('Choose network configuration') + '\n'
181+
header += tr('Recommended: Network Manager for desktop, Manual for server') + '\n'
182+
180183
result = await Selection[NicType](
181184
group,
182-
header=tr('Choose network configuration'),
185+
header=header,
183186
allow_reset=True,
184187
allow_skip=True,
185188
).show()

archinstall/locales/base.pot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,14 @@ msgstr ""
21922192
msgid "Choose network configuration"
21932193
msgstr ""
21942194

2195+
msgid "Recommended: Network Manager for desktop, Manual for server"
2196+
msgstr ""
2197+
2198+
msgid ""
2199+
"Warning: no network configuration selected. Network will need to be set up "
2200+
"manually on the installed system."
2201+
msgstr ""
2202+
21952203
msgid "No packages found"
21962204
msgstr ""
21972205

archinstall/locales/uk/LC_MESSAGES/base.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,12 @@ msgstr "Оберіть інтерфейс"
21332133
msgid "Choose network configuration"
21342134
msgstr "Оберіть конфігурацію мережі"
21352135

2136+
msgid "Recommended: Network Manager for desktop, Manual for server"
2137+
msgstr "Рекомендовано: Network Manager для робочого столу, ручне налаштування для сервера"
2138+
2139+
msgid "Warning: no network configuration selected. Network will need to be set up manually on the installed system."
2140+
msgstr "Попередження: конфігурацію мережі не обрано. Мережу доведеться налаштувати вручну на встановленій системі."
2141+
21362142
msgid "No packages found"
21372143
msgstr "Пакети не знайдено"
21382144

archinstall/scripts/guided.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def main(arch_config_handler: ArchConfigHandler | None = None) -> None:
226226

227227
if not arch_config_handler.args.silent:
228228
aborted = False
229-
res: bool = tui.run(config.confirm_config)
229+
res: bool = tui.run(lambda: config.confirm_config(show_install_warnings=True))
230230

231231
if not res:
232232
debug('Installation aborted')

archinstall/scripts/minimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def main(arch_config_handler: ArchConfigHandler | None = None) -> None:
7777

7878
if not arch_config_handler.args.silent:
7979
aborted = False
80-
res: bool = tui.run(config.confirm_config)
80+
res: bool = tui.run(lambda: config.confirm_config(show_install_warnings=True))
8181

8282
if not res:
8383
debug('Installation aborted')

0 commit comments

Comments
 (0)