index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Daniel <blackrabbit256@gmail.com> | 2022-03-01 01:57:57 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 15:57:57 +0100 |
commit | 537b9cab037aecfd18edef156dd3ea55072918e9 (patch) | |
tree | fe56cd4af527e816d831b220c6672c1dcfc2958f /archinstall/lib/user_interaction.py | |
parent | fa87d85708331ad45f28906217f94937bae474fe (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 35 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 7524dd8b..1f62b7fd 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -14,6 +14,7 @@ from typing import List, Any, Optional, Dict, Union, TYPE_CHECKING # https://stackoverflow.com/a/39757388/929999 from .menu.text_input import TextInput +from .models.network_configuration import NetworkConfiguration, NicType if TYPE_CHECKING: from .disk.partition import Partition @@ -450,11 +451,12 @@ def ask_additional_packages_to_install(pre_set_packages :List[str] = []) -> List return packages -def ask_to_configure_network(preset :Dict[str, Any] = {}) -> Dict[str, Any]: - # Optionally configure one network interface. - # while 1: - # {MAC: Ifname} +def ask_to_configure_network(preset :Dict[str, Any] = {}) -> Optional[NetworkConfiguration]: + """ + Configure the network on the newly installed system + """ interfaces = { + 'none': str(_('No network configuration')), 'iso_config': str(_('Copy ISO network configuration to installation')), 'network_manager': str(_('Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)')), **list_interfaces() @@ -473,17 +475,17 @@ def ask_to_configure_network(preset :Dict[str, Any] = {}) -> Dict[str, Any]: except ValueError: pass - nic = Menu(_('Select one network interface to configure'), interfaces.values(),cursor_index=cursor_idx).run() + nic = Menu(_('Select one network interface to configure'), interfaces.values(), cursor_index=cursor_idx, sort=False).run() if not nic: - return {} - - # nic = network_manager_nt + return None - if nic == interfaces['iso_config']: - return {'type': 'iso_config'} + if nic == interfaces['none']: + return None + elif nic == interfaces['iso_config']: + return NetworkConfiguration(NicType.ISO) elif nic == interfaces['network_manager']: - return {'type': 'network_manager', 'NetworkManager': True} + return NetworkConfiguration(NicType.NM) else: # Current workaround: # For selecting modes without entering text within brackets, @@ -543,10 +545,17 @@ def ask_to_configure_network(preset :Dict[str, Any] = {}) -> Dict[str, Any]: if len(dns_input): dns = dns_input.split(' ') - return {'type': nic, 'dhcp': False, 'ip': ip, 'gateway': gateway, 'dns': dns} + return NetworkConfiguration( + NicType.MANUAL, + iface=nic, + ip=ip, + gateway=gateway, + dns=dns, + dhcp=False + ) else: # this will contain network iface names - return {'type': nic} + return NetworkConfiguration(NicType.MANUAL, iface=nic) def partition_overlap(partitions :list, start :str, end :str) -> bool: |