From 537b9cab037aecfd18edef156dd3ea55072918e9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 1 Mar 2022 01:57:57 +1100 Subject: Rework network config (#1001) * Update network configuration * Rework network configuration * Update documentation * Fix flake8 * Update Co-authored-by: Daniel Girtler Co-authored-by: Anton Hvornum --- examples/config-sample.json | 5 ++--- examples/custom-command-sample.json | 2 +- examples/guided.py | 18 ++++++------------ examples/swiss.py | 17 ++++------------- 4 files changed, 13 insertions(+), 29 deletions(-) (limited to 'examples') diff --git a/examples/config-sample.json b/examples/config-sample.json index 18644860..dc8693a7 100644 --- a/examples/config-sample.json +++ b/examples/config-sample.json @@ -15,8 +15,7 @@ } }, "nic": { - "NetworkManager": true, - "nic": "Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)" + "type": "NM" }, "ntp": true, "packages": [], @@ -26,4 +25,4 @@ "sys-encoding": "utf-8", "sys-language": "en_US", "timezone": "UTC" -} \ No newline at end of file +} diff --git a/examples/custom-command-sample.json b/examples/custom-command-sample.json index 9c39e15f..8d8d611d 100644 --- a/examples/custom-command-sample.json +++ b/examples/custom-command-sample.json @@ -13,7 +13,7 @@ "keyboard-layout": "us", "mirror-region": "Worldwide", "nic": { - "NetworkManager": true + "type": "NM" }, "ntp": true, "packages": ["docker", "git", "wget", "zsh"], diff --git a/examples/guided.py b/examples/guided.py index 23fd45a6..d2447341 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -145,11 +145,11 @@ def perform_installation(mountpoint): # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium - + # Retrieve list of additional repositories and set boolean values appropriately enable_testing = 'testing' in archinstall.arguments.get('additional-repositories', None) enable_multilib = 'multilib' in archinstall.arguments.get('additional-repositories', None) - + if installation.minimal_installation(testing=enable_testing, multilib=enable_multilib): installation.set_locale(archinstall.arguments['sys-language'], archinstall.arguments['sys-encoding'].upper()) installation.set_hostname(archinstall.arguments['hostname']) @@ -163,16 +163,10 @@ def perform_installation(mountpoint): # If user selected to copy the current ISO network configuration # Perform a copy of the config - if archinstall.arguments.get('nic', {}).get('type', '') == 'iso_config': - installation.copy_iso_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('nic', {}).get('NetworkManager', False): - installation.add_additional_packages("networkmanager") - installation.enable_service('NetworkManager.service') - # Otherwise, if a interface was selected, configure that interface - elif archinstall.arguments.get('nic', {}): - installation.configure_nic(**archinstall.arguments.get('nic', {})) - installation.enable_service('systemd-networkd') - installation.enable_service('systemd-resolved') + network_config = archinstall.arguments.get('nic', None) + + if network_config: + network_config.config_installer(installation) if archinstall.arguments.get('audio', None) is not None: installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=logging.INFO) diff --git a/examples/swiss.py b/examples/swiss.py index f60ff60f..4eb51a05 100644 --- a/examples/swiss.py +++ b/examples/swiss.py @@ -393,19 +393,10 @@ def os_setup(installation): if archinstall.arguments['swap']: installation.setup_swap('zram') - # If user selected to copy the current ISO network configuration - # Perform a copy of the config - if archinstall.arguments.get('nic', {}).get('type', '') == 'iso_config': - installation.copy_iso_network_config( - enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('nic', {}).get('NetworkManager', False): - installation.add_additional_packages("networkmanager") - installation.enable_service('NetworkManager.service') - # Otherwise, if a interface was selected, configure that interface - elif archinstall.arguments.get('nic', {}): - installation.configure_nic(**archinstall.arguments.get('nic', {})) - installation.enable_service('systemd-networkd') - installation.enable_service('systemd-resolved') + network_config = archinstall.arguments.get('nic', None) + + if network_config: + network_config.config_installer(installation) if archinstall.arguments.get('audio', None) is not None: installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}",level=logging.INFO) -- cgit v1.2.3-70-g09d2