Merge pull request #273 from dylanmtaylor/patch-2

Restructure Graphics Driver Selection for 2.2.0
This commit is contained in:
Anton Hvornum 2021-04-11 07:58:29 +00:00 committed by GitHub
commit 0d14b4b9dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 82 deletions

View File

@ -1,5 +1,24 @@
import archinstall
def select_driver(options):
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=AVAILABLE_DRIVERS):
"""
Some what convoluted function, which's job is simple.
Select a graphics driver from a pre-defined set of popular options.

View File

@ -10,6 +10,8 @@ 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"]
__base_packages__ = __packages__[:6]

View File

@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm']
supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie']
desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ')
# Temporarily store the selected desktop profile

View File

@ -10,13 +10,9 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
# KDE requires a functioning Xorg installation.
profile = archinstall.Profile(None, 'wayland')
with profile.load_instructions(namespace='wayland.py') as imported:
if hasattr(imported, '_prep_function'):
return imported._prep_function()
else:
print('Deprecated (??): wayland profile has no _prep_function() anymore')
__builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver()
return True
def _post_install(*args, **kwargs):
choice = input("Would you like to autostart sway on login [Y/n]: ")
@ -30,18 +26,20 @@ def _post_install(*args, **kwargs):
f.write(x)
f.close()
else:
installation.log("to start sway run the command sway")
installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and modify it")
installation.log("To start Sway, run the 'sway' command after logging in.")
# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py")
# or through conventional import kde
if __name__ == 'sway':
installation.add_additional_packages(_gfx_driver_packages)
# Install dependency profiles
if _gfx_driver_packages == 'nvidia':
raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not the prorpitery nvidia driver try using nouveau")
else:
installation.install_profile('wayland')
# NOTE: This is technically runnable with the --my-next-gpu-wont-be-nvidia option
raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not officially support the proprietary Nvidia driver, you may have to use nouveau.")
# Install the application kde from the template under /applications/
sway = archinstall.Application(installation, 'sway')
sway.install()
# Install the application kde from the template under /applications/
sway = archinstall.Application(installation, 'sway')
sway.install()

View File

@ -1,43 +0,0 @@
import archinstall, os
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 _prep_function(*args, **kwargs):
"""
Magic function called by the importing installer
before continuing any further. It also avoids executing any
other code in this stage. So it's a safe way to ask the user
for more input before any other installer steps start.
"""
print('You need to select which graphics card you\'re using.')
print('This in order to setup the required graphics drivers.')
__builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS)
# TODO: Add language section and/or merge it with the locale selected
# earlier in for instance guided.py installer.
return True
if __name__ == "__wayland__":
try:
installation.add_additional_packages(f"wayland {' '.join(_gfx_driver_packages)}")
except:
installation.add_additional_packages(f"wayland") # Prep didn't run, so there's no driver to install

View File

@ -4,25 +4,6 @@ import archinstall, os
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 _prep_function(*args, **kwargs):
"""
Magic function called by the importing installer
@ -30,10 +11,8 @@ def _prep_function(*args, **kwargs):
other code in this stage. So it's a safe way to ask the user
for more input before any other installer steps start.
"""
print('You need to select which graphics card you\'re using.')
print('This in order to setup the required graphics drivers.')
__builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS)
__builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver()
# TODO: Add language section and/or merge it with the locale selected
# earlier in for instance guided.py installer.