Fix iwd network installation and setup (#4271)
* Fix 4223 - IWD * Update * Update
This commit is contained in:
parent
cfdcebcacd
commit
8e34303175
|
|
@ -31,8 +31,6 @@ class DesktopProfile(Profile):
|
||||||
'openssh',
|
'openssh',
|
||||||
'htop',
|
'htop',
|
||||||
'wget',
|
'wget',
|
||||||
'iwd',
|
|
||||||
'wireless_tools',
|
|
||||||
'smartmontools',
|
'smartmontools',
|
||||||
'xdg-utils',
|
'xdg-utils',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -805,14 +805,6 @@ class Installer:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def configure_nm_iwd(self) -> None:
|
|
||||||
# Create NetworkManager config directory and write iwd backend conf
|
|
||||||
nm_conf_dir = self.target / 'etc/NetworkManager/conf.d'
|
|
||||||
nm_conf_dir.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
|
|
||||||
iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')
|
|
||||||
|
|
||||||
def mkinitcpio(self, flags: list[str]) -> bool:
|
def mkinitcpio(self, flags: list[str]) -> bool:
|
||||||
for plugin in plugins.values():
|
for plugin in plugins.values():
|
||||||
if hasattr(plugin, 'on_mkinitcpio'):
|
if hasattr(plugin, 'on_mkinitcpio'):
|
||||||
|
|
|
||||||
|
|
@ -3,40 +3,45 @@ from archinstall.lib.models.network import NetworkConfiguration, NicType
|
||||||
from archinstall.lib.models.profile import ProfileConfiguration
|
from archinstall.lib.models.profile import ProfileConfiguration
|
||||||
|
|
||||||
|
|
||||||
class NetworkHandler:
|
def install_network_config(
|
||||||
def install_network_config(
|
network_config: NetworkConfiguration,
|
||||||
self,
|
installation: Installer,
|
||||||
network_config: NetworkConfiguration,
|
profile_config: ProfileConfiguration | None = None,
|
||||||
installation: Installer,
|
) -> None:
|
||||||
profile_config: ProfileConfiguration | None = None,
|
match network_config.type:
|
||||||
) -> None:
|
case NicType.ISO:
|
||||||
match network_config.type:
|
_ = installation.copy_iso_network_config(
|
||||||
case NicType.ISO:
|
enable_services=True, # Sources the ISO network configuration to the install medium.
|
||||||
_ = installation.copy_iso_network_config(
|
)
|
||||||
enable_services=True, # Sources the ISO network configuration to the install medium.
|
case NicType.NM | NicType.NM_IWD:
|
||||||
)
|
packages = ['networkmanager']
|
||||||
case NicType.NM | NicType.NM_IWD:
|
|
||||||
# Install NetworkManager package for both cases
|
|
||||||
packages = ['networkmanager']
|
|
||||||
# Default back-end only for non-iwd
|
|
||||||
if network_config.type == NicType.NM:
|
|
||||||
packages.append('wpa_supplicant')
|
|
||||||
|
|
||||||
installation.add_additional_packages(packages)
|
if network_config.type == NicType.NM:
|
||||||
|
packages.append('wpa_supplicant')
|
||||||
|
else:
|
||||||
|
packages.append('iwd')
|
||||||
|
|
||||||
# Desktop profile -> Always add applet
|
if profile_config and profile_config.profile:
|
||||||
if profile_config and profile_config.profile:
|
if profile_config.profile.is_desktop_profile():
|
||||||
if profile_config.profile.is_desktop_profile():
|
packages.append('network-manager-applet')
|
||||||
installation.add_additional_packages('network-manager-applet')
|
|
||||||
|
|
||||||
installation.enable_service('NetworkManager.service')
|
installation.add_additional_packages(packages)
|
||||||
if network_config.type == NicType.NM_IWD:
|
installation.enable_service('NetworkManager.service')
|
||||||
# NM_IWD special handling
|
|
||||||
installation.configure_nm_iwd()
|
|
||||||
installation.disable_service('iwd.service')
|
|
||||||
|
|
||||||
case NicType.MANUAL:
|
if network_config.type == NicType.NM_IWD:
|
||||||
for nic in network_config.nics:
|
_configure_nm_iwd(installation)
|
||||||
installation.configure_nic(nic)
|
installation.disable_service('iwd.service')
|
||||||
installation.enable_service('systemd-networkd')
|
|
||||||
installation.enable_service('systemd-resolved')
|
case NicType.MANUAL:
|
||||||
|
for nic in network_config.nics:
|
||||||
|
installation.configure_nic(nic)
|
||||||
|
installation.enable_service('systemd-networkd')
|
||||||
|
installation.enable_service('systemd-resolved')
|
||||||
|
|
||||||
|
|
||||||
|
def _configure_nm_iwd(installation: Installer) -> None:
|
||||||
|
nm_conf_dir = installation.target / 'etc/NetworkManager/conf.d'
|
||||||
|
nm_conf_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
|
||||||
|
_ = iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from archinstall.lib.mirrors import MirrorListHandler
|
||||||
from archinstall.lib.models import Bootloader
|
from archinstall.lib.models import Bootloader
|
||||||
from archinstall.lib.models.device import DiskLayoutType, EncryptionType
|
from archinstall.lib.models.device import DiskLayoutType, EncryptionType
|
||||||
from archinstall.lib.models.users import User
|
from archinstall.lib.models.users import User
|
||||||
from archinstall.lib.network.network_handler import NetworkHandler
|
from archinstall.lib.network.network_handler import install_network_config
|
||||||
from archinstall.lib.output import debug, error, info
|
from archinstall.lib.output import debug, error, info
|
||||||
from archinstall.lib.packages.util import check_version_upgrade
|
from archinstall.lib.packages.util import check_version_upgrade
|
||||||
from archinstall.lib.profile.profiles_handler import profile_handler
|
from archinstall.lib.profile.profiles_handler import profile_handler
|
||||||
|
|
@ -118,7 +118,7 @@ def perform_installation(
|
||||||
installation.add_bootloader(config.bootloader_config.bootloader, config.bootloader_config.uki, config.bootloader_config.removable)
|
installation.add_bootloader(config.bootloader_config.bootloader, config.bootloader_config.uki, config.bootloader_config.removable)
|
||||||
|
|
||||||
if config.network_config:
|
if config.network_config:
|
||||||
NetworkHandler().install_network_config(
|
install_network_config(
|
||||||
config.network_config,
|
config.network_config,
|
||||||
installation,
|
installation,
|
||||||
config.profile_config,
|
config.profile_config,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from archinstall.lib.menu.util import delayed_warning
|
||||||
from archinstall.lib.models import Bootloader
|
from archinstall.lib.models import Bootloader
|
||||||
from archinstall.lib.models.profile import ProfileConfiguration
|
from archinstall.lib.models.profile import ProfileConfiguration
|
||||||
from archinstall.lib.models.users import Password, User
|
from archinstall.lib.models.users import Password, User
|
||||||
from archinstall.lib.network.network_handler import NetworkHandler
|
from archinstall.lib.network.network_handler import install_network_config
|
||||||
from archinstall.lib.output import debug, error, info
|
from archinstall.lib.output import debug, error, info
|
||||||
from archinstall.lib.profile.profiles_handler import profile_handler
|
from archinstall.lib.profile.profiles_handler import profile_handler
|
||||||
from archinstall.lib.translationhandler import tr
|
from archinstall.lib.translationhandler import tr
|
||||||
|
|
@ -40,7 +40,7 @@ def perform_installation(arch_config_handler: ArchConfigHandler) -> None:
|
||||||
installation.add_bootloader(Bootloader.Systemd)
|
installation.add_bootloader(Bootloader.Systemd)
|
||||||
|
|
||||||
if config.network_config:
|
if config.network_config:
|
||||||
NetworkHandler().install_network_config(
|
install_network_config(
|
||||||
config.network_config,
|
config.network_config,
|
||||||
installation,
|
installation,
|
||||||
config.profile_config,
|
config.profile_config,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue