Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples/guided.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-11-11 20:20:46 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-11-11 20:20:46 +0000
commitb3bcf54a2cb915b8dd9f59d6a85a5ea45f61fd96 (patch)
tree29976dab28106baa067552fc523aa78f42c58eb0 /examples/guided.py
parentabfeeb8dd0cadadbe38310e96a61e31088652d82 (diff)
Fixed generic_select() to accept (and break on) empty selects.
Diffstat (limited to 'examples/guided.py')
-rw-r--r--examples/guided.py53
1 files changed, 27 insertions, 26 deletions
diff --git a/examples/guided.py b/examples/guided.py
index 4edc593e..039296c8 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -184,32 +184,33 @@ while 1:
print(e)
# Optionally configure one network interface.
-while 1:
- interfaces = archinstall.list_interfaces() # {MAC: Ifname}
- archinstall.storage['_guided']['network'] = None
-
- nic = archinstall.generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ")
- if nic:
- mode = archinstall.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}
+#while 1:
+interfaces = archinstall.list_interfaces() # {MAC: Ifname}
+archinstall.storage['_guided']['network'] = None
+
+nic = archinstall.generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ")
+if nic:
+ mode = archinstall.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:')