MCPcopy Create free account
hub / github.com/archlinux/archinstall / select_network

Function select_network

archinstall/lib/network/network_menu.py:169–214  ·  view source on GitHub ↗

Configure the network on the newly installed system

(preset: NetworkConfiguration | None)

Source from the content-addressed store, hash-verified

167
168
169async def select_network(preset: NetworkConfiguration | None) -> NetworkConfiguration | None:
170 """
171 Configure the network on the newly installed system
172 """
173
174 items = [MenuItem(n.display_msg(), value=n) for n in NicType]
175 group = MenuItemGroup(items, sort_items=False)
176
177 if preset:
178 group.set_selected_by_value(preset.type)
179
180 header = tr('Choose network configuration') + '\n'
181 header += tr('Recommended: Network Manager for desktop, Manual for server') + '\n'
182
183 result = await Selection[NicType](
184 group,
185 header=header,
186 allow_reset=True,
187 allow_skip=True,
188 ).show()
189
190 match result.type_:
191 case ResultType.Skip:
192 return preset
193 case ResultType.Reset:
194 return None
195 case ResultType.Selection:
196 config = result.get_value()
197
198 match config:
199 case NicType.ISO:
200 return NetworkConfiguration(NicType.ISO)
201 case NicType.NM:
202 return NetworkConfiguration(NicType.NM)
203 case NicType.NM_IWD:
204 return NetworkConfiguration(NicType.NM_IWD)
205 case NicType.IWD:
206 return NetworkConfiguration(NicType.IWD)
207 case NicType.MANUAL:
208 preset_nics = preset.nics if preset else []
209 nics = await ManualNetworkConfig(tr('Configure interfaces'), preset_nics).show()
210
211 if nics:
212 return NetworkConfiguration(NicType.MANUAL, nics)
213
214 return preset

Callers

nothing calls this directly

Calls 9

set_selected_by_valueMethod · 0.95
MenuItemClass · 0.90
MenuItemGroupClass · 0.90
trFunction · 0.90
ManualNetworkConfigClass · 0.85
display_msgMethod · 0.45
showMethod · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected