Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorSecondThundeR <awayfromgalaxy@gmail.com>2021-04-19 20:34:35 +0300
committerSecondThundeR <awayfromgalaxy@gmail.com>2021-04-19 20:34:35 +0300
commitd2eacffff8e5ad560c55300477cdf28f475eb36c (patch)
tree7b79686cbfb50a75274541a6ba894553b0fbcf07 /profiles
parenta316846121caf4b26f96bed8dbe057b649cc409d (diff)
Update some functions
Here are list of changes: - Added IP/subnet validation using Python's `ipaddress` module - Added workaround for network configuration modes where user can enter DHCP or IP without brackets. - Returned local printing options for some functions to keep `The above list...` - Moved booleans for `generic_select` below options and text parameters - Imported some functions from `archinstall` to reduce the`archinstall.` part of the lines. - Reduced variable name length for simplicity - Fixed some typos
Diffstat (limited to 'profiles')
-rw-r--r--profiles/desktop.py3
-rw-r--r--profiles/i3.py3
-rw-r--r--profiles/xorg.py22
3 files changed, 18 insertions, 10 deletions
diff --git a/profiles/desktop.py b/profiles/desktop.py
index b46bf6fd..d350cd71 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -17,7 +17,8 @@ def _prep_function(*args, **kwargs):
"""
supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate']
- desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', False)
+ desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ',
+ allow_empty_input=False)
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
diff --git a/profiles/i3.py b/profiles/i3.py
index fc427186..923b2f2b 100644
--- a/profiles/i3.py
+++ b/profiles/i3.py
@@ -17,7 +17,8 @@ def _prep_function(*args, **kwargs):
"""
supported_configurations = ['i3-wm', 'i3-gaps']
- desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', False)
+ desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ',
+ allow_empty_input=False)
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
diff --git a/profiles/xorg.py b/profiles/xorg.py
index 8c6f686d..130f3ed0 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -1,6 +1,7 @@
# A system with "xorg" installed
-import archinstall, os
+import os
+from archinstall import generic_select, sys_command, RequirementError
is_top_level_profile = True
@@ -33,10 +34,13 @@ def select_driver(options):
drivers = sorted(list(options))
if len(drivers) >= 1:
- print(' -- The below list are supported graphic card drivers. --')
+ for index, driver in enumerate(drivers):
+ print(f"{index}: {driver}")
+
+ print(' -- The above list are supported graphic card drivers. --')
print(' -- You need to select (and read about) which one you need. --')
- lspci = archinstall.sys_command(f'/usr/bin/lspci')
+ lspci = sys_command(f'/usr/bin/lspci')
for line in lspci.trace_log.split(b'\r\n'):
if b' vga ' in line.lower():
if b'nvidia' in line.lower():
@@ -44,7 +48,8 @@ def select_driver(options):
elif b'amd' in line.lower():
print(' ** AMD card detected, suggested driver: AMD / ATI **')
- selected_driver = archinstall.generic_select(drivers, 'Select your graphics card driver: ', False)
+ selected_driver = generic_select(drivers, 'Select your graphics card driver: ',
+ allow_empty_input=False, options_output=False)
initial_option = selected_driver
# Disabled search for now, only a few profiles exist anyway
@@ -60,14 +65,15 @@ def select_driver(options):
if type(selected_driver) == dict:
driver_options = sorted(list(selected_driver))
- selected_driver_package_group = archinstall.generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', False)
- selected_driver_package_group = selected_driver[selected_driver_package_group]
+ driver_package_group = generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ',
+ allow_empty_input=False)
+ driver_package_group = selected_driver[driver_package_group]
- return selected_driver_package_group
+ return driver_package_group
return selected_driver
- raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.")
+ raise RequirementError("Selecting drivers require a least one profile to be given as an option.")
def _prep_function(*args, **kwargs):
"""