index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | advaithm <advaith.madhukar@gmail.com> | 2021-04-22 16:41:47 +0530 |
---|---|---|
committer | advaithm <advaith.madhukar@gmail.com> | 2021-04-22 16:41:47 +0530 |
commit | 15d56c2bc7174a80aa23ef8f0896c286b925a382 (patch) | |
tree | 1eba21f2967be7be8534a584e371bbde51441812 /profiles | |
parent | e6ab22f28cc71daa87286d7262c07fa45ab628d7 (diff) | |
parent | c88034fa8a76b4bff4f626b5467767457d6fef62 (diff) |
-rw-r--r-- | profiles/desktop.py | 5 | ||||
-rw-r--r-- | profiles/i3.py | 3 | ||||
-rw-r--r-- | profiles/xorg.py | 73 |
diff --git a/profiles/desktop.py b/profiles/desktop.py index dce2e18b..2aea6d30 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,8 +16,9 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate', 'deepin'] - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] + desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', + allow_empty_input=False, sort=True) # 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 67028b2d..b82c03d6 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: ') + desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', + allow_empty_input=False, sort=True) # 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 42597a37..8e9779bc 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -1,9 +1,80 @@ # A system with "xorg" installed -import archinstall, os +import os +from archinstall import generic_select, sys_command, RequirementError is_top_level_profile = True +AVAILABLE_DRIVERS = { + # Sub-dicts are layer-2 options to be selected + # and lists are a list of packages to be installed + 'AMD / ATI' : { + 'amd' : ['xf86-video-amdgpu'], + 'ati' : ['xf86-video-ati'] + }, + 'intel' : ['xf86-video-intel'], + 'nvidia' : { + 'open source' : ['xf86-video-nouveau'], + 'proprietary' : ['nvidia'] + }, + 'mesa' : ['mesa'], + 'fbdev' : ['xf86-video-fbdev'], + 'vesa' : ['xf86-video-vesa'], + 'vmware' : ['xf86-video-vmware'] +} + +def select_driver(options): + """ + Some what convoluted function, which's job is simple. + Select a graphics driver from a pre-defined set of popular options. + + (The template xorg is for beginner users, not advanced, and should + there for appeal to the general public first and edge cases later) + """ + drivers = sorted(list(options)) + + if len(drivers) >= 1: + 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 = 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(): + print(' ** nvidia card detected, suggested driver: nvidia **') + elif b'amd' in line.lower(): + print(' ** AMD card detected, suggested driver: AMD / ATI **') + + 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 + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + + selected_driver = options[selected_driver] + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + + 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 driver_package_group + + return selected_driver + + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer |