Add iwd standalone option to network configuration
Adds NicType.IWD as a third option alongside NM and NM_IWD: install iwd, write /etc/iwd/main.conf with EnableNetworkConfiguration=true and NameResolvingService=systemd, enable iwd.service + systemd-resolved.service. iwd handles DHCP itself and resolved picks up its DNS via the symlink, so no NetworkManager pulled in. Also fills in parse_arg cases for NM_IWD and IWD so config files round-trip both nic types. Assisted-By: Flint
This commit is contained in:
parent
af106eb238
commit
49c4206c86
|
|
@ -11,6 +11,7 @@ class NicType(Enum):
|
|||
ISO = 'iso'
|
||||
NM = 'nm'
|
||||
NM_IWD = 'nm_iwd'
|
||||
IWD = 'iwd'
|
||||
MANUAL = 'manual'
|
||||
|
||||
def display_msg(self) -> str:
|
||||
|
|
@ -21,6 +22,8 @@ class NicType(Enum):
|
|||
return tr('Use Network Manager (default backend)')
|
||||
case NicType.NM_IWD:
|
||||
return tr('Use Network Manager (iwd backend)')
|
||||
case NicType.IWD:
|
||||
return tr('Use iwd standalone (no Network Manager)')
|
||||
case NicType.MANUAL:
|
||||
return tr('Manual configuration')
|
||||
|
||||
|
|
@ -125,6 +128,10 @@ class NetworkConfiguration:
|
|||
return cls(NicType.ISO)
|
||||
case NicType.NM:
|
||||
return cls(NicType.NM)
|
||||
case NicType.NM_IWD:
|
||||
return cls(NicType.NM_IWD)
|
||||
case NicType.IWD:
|
||||
return cls(NicType.IWD)
|
||||
case NicType.MANUAL:
|
||||
nics_arg = config.get('nics', [])
|
||||
if nics_arg:
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ def install_network_config(
|
|||
_configure_nm_iwd(installation)
|
||||
installation.disable_service('iwd.service')
|
||||
|
||||
case NicType.IWD:
|
||||
installation.add_additional_packages(['iwd'])
|
||||
_configure_iwd_standalone(installation)
|
||||
installation.enable_service('iwd.service')
|
||||
installation.enable_service('systemd-resolved.service')
|
||||
|
||||
case NicType.MANUAL:
|
||||
for nic in network_config.nics:
|
||||
installation.configure_nic(nic)
|
||||
|
|
@ -45,3 +51,12 @@ def _configure_nm_iwd(installation: Installer) -> None:
|
|||
|
||||
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
|
||||
_ = iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')
|
||||
|
||||
|
||||
def _configure_iwd_standalone(installation: Installer) -> None:
|
||||
# Let iwd handle DHCP/DNS itself; resolved picks up its DNS via the symlink.
|
||||
iwd_conf_dir = installation.target / 'etc/iwd'
|
||||
iwd_conf_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
main_conf = iwd_conf_dir / 'main.conf'
|
||||
_ = main_conf.write_text('[General]\nEnableNetworkConfiguration=true\n\n[Network]\nNameResolvingService=systemd\n')
|
||||
|
|
|
|||
|
|
@ -202,6 +202,8 @@ async def select_network(preset: NetworkConfiguration | None) -> NetworkConfigur
|
|||
return NetworkConfiguration(NicType.NM)
|
||||
case NicType.NM_IWD:
|
||||
return NetworkConfiguration(NicType.NM_IWD)
|
||||
case NicType.IWD:
|
||||
return NetworkConfiguration(NicType.IWD)
|
||||
case NicType.MANUAL:
|
||||
preset_nics = preset.nics if preset else []
|
||||
nics = await ManualNetworkConfig(tr('Configure interfaces'), preset_nics).show()
|
||||
|
|
|
|||
Loading…
Reference in New Issue