Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-03-01 01:57:57 +1100
committerGitHub <noreply@github.com>2022-02-28 15:57:57 +0100
commit537b9cab037aecfd18edef156dd3ea55072918e9 (patch)
treefe56cd4af527e816d831b220c6672c1dcfc2958f /archinstall/lib/user_interaction.py
parentfa87d85708331ad45f28906217f94937bae474fe (diff)
Rework network config (#1001)
* Update network configuration * Rework network configuration * Update documentation * Fix flake8 * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton.feeds@gmail.com>
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py35
1 files changed, 22 insertions, 13 deletions
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: