Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-11-11 20:13:26 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-11-11 20:13:26 +0000
commit72fb912b6b1593a9eea690be88034bd96dd3dcd9 (patch)
tree5c280e3020cd8989acb57e7dbd1dca233d9aeda4 /examples
parent07d70a0a916b3c7ede34671603c1e964a1c7bf30 (diff)
Adding network support (questions) to guided.py according to #65. Previous commit added the functionality to configure the nic inside the installation.
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/guided.py b/examples/guided.py
index c0fcd97b..a69cc622 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -49,6 +49,9 @@ def perform_installation(device, boot_partition, language, mirrors):
installation.set_keyboard_language(language)
installation.add_bootloader()
+ if archinstall.storage['_guided']['network']:
+ archinstall.configure_nic(**archinstall.storage['_guided']['network'])
+
if len(archinstall.storage['_guided']['packages']) and archinstall.storage['_guided']['packages'][0] != '':
installation.add_additional_packages(archinstall.storage['_guided']['packages'])
@@ -180,6 +183,33 @@ while 1:
except archinstall.RequirementError as e:
print(e)
+# Optionally configure one network interface.
+while 1:
+ interfaces = archinstall.list_interfaces()
+ archinstall.storage['_guided']['network'] = None
+
+ nic = generic_select(interfaces, "Select one network interface to configure (leave blank to skip): ")
+ if nic:
+ mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ")
+ if mode == 'IP (static)':
+ while 1:
+ ip = input(f"Enter the IP and subnet for {nic} (example: 192.168.0.5/24): ").strip()
+ if ip:
+ break
+ else:
+ ArchInstall.log(
+ "You need to enter a valid IP in IP-config mode.",
+ level=archinstall.LOG_LEVELS.Warning,
+ bg='black',
+ fg='red'
+ )
+
+ gateway = input('Enter your gateway (router) IP address or leave blank for none: ').strip()
+ dns = input('Enter your DNS servers (space separated, blank for none): ').strip().split(' ')
+
+ archinstall.storage['_guided']['network'] = {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}
+ else:
+ archinstall.storage['_guided']['network'] = {'nic': nic}
print()
print('This is your chosen configuration:')