Skip to content

Commit c1eae10

Browse files
authored
Enable IWD to be used as back-end in network selection (#4025)
* feedback * feedback2 * Refactor for less duplicate code and more conscise logic Group NM types and handle configurations appropriatly - For IWD -> Copy from ISO + Disable standalone and configure back-end - For standard -> Install wpa_supplicant - For both install applet only when Desktop profile Added comments for clearer logic * Rem comments * Rem copy to ISO * the one commit to rule them all
1 parent 42a4ee8 commit c1eae10

4 files changed

Lines changed: 31 additions & 6 deletions

File tree

archinstall/default_profiles/desktop.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def packages(self) -> list[str]:
3232
'wget',
3333
'iwd',
3434
'wireless_tools',
35-
'wpa_supplicant',
3635
'smartmontools',
3736
'xdg-utils',
3837
]

archinstall/lib/installer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,14 @@ def post_install_enable_networkd_resolved(*args: str, **kwargs: str) -> None:
768768

769769
return True
770770

771+
def configure_nm_iwd(self) -> None:
772+
# Create NetworkManager config directory and write iwd backend conf
773+
nm_conf_dir = self.target / 'etc/NetworkManager/conf.d'
774+
nm_conf_dir.mkdir(parents=True, exist_ok=True)
775+
776+
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
777+
iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')
778+
771779
def mkinitcpio(self, flags: list[str]) -> bool:
772780
for plugin in plugins.values():
773781
if hasattr(plugin, 'on_mkinitcpio'):

archinstall/lib/interactions/network_menu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ def ask_to_configure_network(preset: NetworkConfiguration | None) -> NetworkConf
212212
return NetworkConfiguration(NicType.ISO)
213213
case NicType.NM:
214214
return NetworkConfiguration(NicType.NM)
215+
case NicType.NM_IWD:
216+
return NetworkConfiguration(NicType.NM_IWD)
215217
case NicType.MANUAL:
216218
preset_nics = preset.nics if preset else []
217219
nics = ManualNetworkConfig(tr('Configure interfaces'), preset_nics).run()

archinstall/lib/models/network.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
class NicType(Enum):
1818
ISO = 'iso'
1919
NM = 'nm'
20+
NM_IWD = 'nm_iwd'
2021
MANUAL = 'manual'
2122

2223
def display_msg(self) -> str:
2324
match self:
2425
case NicType.ISO:
2526
return tr('Copy ISO network configuration to installation')
2627
case NicType.NM:
27-
return tr('Use NetworkManager (necessary to configure internet graphically in GNOME and KDE Plasma)')
28+
return tr('Use Network Manager (default backend)')
29+
case NicType.NM_IWD:
30+
return tr('Use Network Manager (iwd backend)')
2831
case NicType.MANUAL:
2932
return tr('Manual configuration')
3033

@@ -147,16 +150,29 @@ def install_network_config(
147150
installation.copy_iso_network_config(
148151
enable_services=True, # Sources the ISO network configuration to the install medium.
149152
)
150-
case NicType.NM:
151-
installation.add_additional_packages(['networkmanager'])
153+
case NicType.NM | NicType.NM_IWD:
154+
# Install NetworkManager package for both cases
155+
packages = ['networkmanager']
156+
# Defautl back-end only for non-iwd
157+
if self.type == NicType.NM:
158+
packages.append('wpa_supplicant')
159+
160+
installation.add_additional_packages(packages)
161+
162+
# Desktop profile -> Always add applet
152163
if profile_config and profile_config.profile:
153164
if profile_config.profile.is_desktop_profile():
154-
installation.add_additional_packages(['network-manager-applet'])
165+
installation.add_additional_packages('network-manager-applet')
166+
155167
installation.enable_service('NetworkManager.service')
168+
if self.type == NicType.NM_IWD:
169+
# NM_IWD special handling
170+
installation.configure_nm_iwd()
171+
installation.disable_service('iwd.service')
172+
156173
case NicType.MANUAL:
157174
for nic in self.nics:
158175
installation.configure_nic(nic)
159-
160176
installation.enable_service('systemd-networkd')
161177
installation.enable_service('systemd-resolved')
162178

0 commit comments

Comments
 (0)