Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-11 08:21:38 +0000
committerGitHub <noreply@github.com>2021-04-11 08:21:38 +0000
commit94c31222fab7d5fa02f6f2393893e248d64a8dcb (patch)
treef91fcc0eb351dc54b24364d232c758573be50cc9
parent0d14b4b9dc99e519818de091533ca9fb2f2d223c (diff)
parent1292c07796b763b926fd5edb21905a663eaef8f0 (diff)
Merge pull request #276 from archlinux/torxed-gfx-fix
Fixed PR #273. Moved the graphic drivers into hardware
-rw-r--r--archinstall/lib/hardware.py19
-rw-r--r--archinstall/lib/installer.py1
-rw-r--r--archinstall/lib/user_interaction.py67
-rw-r--r--profiles/sway.py2
-rw-r--r--profiles/xorg.py2
5 files changed, 88 insertions, 3 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 3da333de..047b3491 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -2,6 +2,25 @@ import os, subprocess, json
from .general import sys_command
from .networking import list_interfaces, enrichIfaceTypes
from typing import Optional
+
+AVAILABLE_GFX_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 hasWifi()->bool:
return 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values()
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 5523b1e1..484e7407 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -10,7 +10,6 @@ from .systemd import Networkd
from .output import log, LOG_LEVELS
from .storage import storage
from .hardware import *
-from .gfx_drivers import *
# Any package that the Installer() is responsible for (optional and the default ones)
__packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"]
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index b94bf3f5..d17691de 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -5,6 +5,8 @@ from .locale_helpers import search_keyboard_layout
from .output import log, LOG_LEVELS
from .storage import storage
from .networking import list_interfaces
+from .general import sys_command
+from .hardware import AVAILABLE_GFX_DRIVERS
## TODO: Some inconsistencies between the selection processes.
## Some return the keys from the options, some the values?
@@ -363,3 +365,68 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
return selected_mirrors
raise RequirementError("Selecting mirror region require a least one region to be given as an option.")
+
+def select_driver(options=AVAILABLE_GFX_DRIVERS):
+ """
+ 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 = input('Select your graphics card driver: ')
+ 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)
+ if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1:
+ selected_driver = options[drivers[pos]]
+ elif selected_driver in options:
+ selected_driver = options[options.index(selected_driver)]
+ elif len(selected_driver) == 0:
+ raise RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.")
+ else:
+ raise RequirementError("Selected driver does not exist.")
+
+ if type(selected_driver) == dict:
+ driver_options = sorted(list(selected_driver))
+ for index, driver_package_group in enumerate(driver_options):
+ print(f"{index}: {driver_package_group}")
+
+ selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ')
+ if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1:
+ selected_driver_package_group = selected_driver[driver_options[pos]]
+ elif selected_driver_package_group in selected_driver:
+ selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)]
+ elif len(selected_driver_package_group) == 0:
+ raise RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.")
+ else:
+ raise RequirementError(f"Selected driver-type does not exist for {initial_option}.")
+
+ return selected_driver_package_group
+
+ return selected_driver
+
+ raise RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file
diff --git a/profiles/sway.py b/profiles/sway.py
index 10e30753..f1d2c1f1 100644
--- a/profiles/sway.py
+++ b/profiles/sway.py
@@ -10,7 +10,7 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
- __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver()
+ __builtins__['_gfx_driver_packages'] = archinstall.select_driver()
return True
diff --git a/profiles/xorg.py b/profiles/xorg.py
index 6ee72487..42597a37 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
- __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver()
+ __builtins__['_gfx_driver_packages'] = archinstall.select_driver()
# TODO: Add language section and/or merge it with the locale selected
# earlier in for instance guided.py installer.