Multiple restructuring changes

This commit is contained in:
Dylan Taylor 2021-04-10 11:58:53 -04:00
parent d510ad5b98
commit 5f46f76bd5
4 changed files with 36 additions and 38 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

@ -12,6 +12,8 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
__builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver()
supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm']
desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ')

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

@ -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.