Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions archinstall/default_profiles/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def packages(self) -> list[str]:
'openssh',
'htop',
'wget',
'iwd',
'wireless_tools',
'smartmontools',
'xdg-utils',
]
Expand Down
8 changes: 0 additions & 8 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,14 +808,6 @@ def post_install_enable_networkd_resolved(*args: str, **kwargs: str) -> None:

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:
for plugin in plugins.values():
if hasattr(plugin, 'on_mkinitcpio'):
Expand Down
79 changes: 42 additions & 37 deletions archinstall/lib/network/network_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,45 @@
from archinstall.lib.models.profile import ProfileConfiguration


class NetworkHandler:
def install_network_config(
self,
network_config: NetworkConfiguration,
installation: Installer,
profile_config: ProfileConfiguration | None = None,
) -> None:
match network_config.type:
case NicType.ISO:
_ = installation.copy_iso_network_config(
enable_services=True, # Sources the ISO network configuration to the install medium.
)
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)

# Desktop profile -> Always add applet
if profile_config and profile_config.profile:
if profile_config.profile.is_desktop_profile():
installation.add_additional_packages('network-manager-applet')

installation.enable_service('NetworkManager.service')
if network_config.type == NicType.NM_IWD:
# NM_IWD special handling
installation.configure_nm_iwd()
installation.disable_service('iwd.service')

case NicType.MANUAL:
for nic in network_config.nics:
installation.configure_nic(nic)
installation.enable_service('systemd-networkd')
installation.enable_service('systemd-resolved')
def install_network_config(
network_config: NetworkConfiguration,
installation: Installer,
profile_config: ProfileConfiguration | None = None,
) -> None:
match network_config.type:
case NicType.ISO:
_ = 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']

if network_config.type == NicType.NM:
packages.append('wpa_supplicant')
else:
packages.append('iwd')

if profile_config and profile_config.profile:
if profile_config.profile.is_desktop_profile():
packages.append('network-manager-applet')

installation.add_additional_packages(packages)
installation.enable_service('NetworkManager.service')

if network_config.type == NicType.NM_IWD:
_configure_nm_iwd(installation)
installation.disable_service('iwd.service')

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')
4 changes: 2 additions & 2 deletions archinstall/scripts/guided.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from archinstall.lib.models import Bootloader
from archinstall.lib.models.device import DiskLayoutType, EncryptionType
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.packages.util import check_version_upgrade
from archinstall.lib.profile.profiles_handler import profile_handler
Expand Down Expand Up @@ -114,7 +114,7 @@ def perform_installation(
installation.add_bootloader(config.bootloader_config.bootloader, config.bootloader_config.uki, config.bootloader_config.removable)

if config.network_config:
NetworkHandler().install_network_config(
install_network_config(
config.network_config,
installation,
config.profile_config,
Expand Down
4 changes: 2 additions & 2 deletions archinstall/scripts/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from archinstall.lib.models import Bootloader
from archinstall.lib.models.profile import ProfileConfiguration
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.profile.profiles_handler import profile_handler

Expand Down Expand Up @@ -38,7 +38,7 @@ def perform_installation(mountpoint: Path) -> None:
installation.add_bootloader(Bootloader.Systemd)

if config.network_config:
NetworkHandler().install_network_config(
install_network_config(
config.network_config,
installation,
config.profile_config,
Expand Down