Merge pull request #286 from dylanmtaylor/patch-5
Use generic_select for GPU drivers
This commit is contained in:
commit
7c902a6c83
|
|
@ -0,0 +1,28 @@
|
||||||
|
# This workflow will build an Arch Linux ISO file with the commit on it
|
||||||
|
|
||||||
|
name: Build Arch ISO with ArchInstall Commit
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux:latest
|
||||||
|
options: --privileged
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: pwd
|
||||||
|
- run: find .
|
||||||
|
- run: cat /etc/os-release
|
||||||
|
- run: mkdir -p /tmp/archlive/airootfs/root/archinstall-git; cp -r . /tmp/archlive/airootfs/root/archinstall-git
|
||||||
|
- run: echo "pip uninstall archinstall -y; cd archinstall-git; python setup.py install; echo 'Type python -m archinstall to launch archinstall'" > /tmp/archlive/airootfs/root/.zprofile
|
||||||
|
- run: pacman -Sy; pacman --noconfirm -S git archiso
|
||||||
|
- run: cp -r /usr/share/archiso/configs/releng/* /tmp/archlive
|
||||||
|
- run: echo -e "git\npython\npython-pip\npython-setuptools" >> /tmp/archlive/packages.x86_64
|
||||||
|
- run: find /tmp/archlive
|
||||||
|
- run: cd /tmp/archlive; mkarchiso -v -w work/ -o out/ ./
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Arch Live ISO
|
||||||
|
path: /tmp/archlive/out/*.iso
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
import archinstall
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
(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 = archinstall.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 archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.")
|
|
||||||
else:
|
|
||||||
raise archinstall.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 archinstall.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 archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.")
|
|
||||||
|
|
||||||
return selected_driver_package_group
|
|
||||||
|
|
||||||
return selected_driver
|
|
||||||
|
|
||||||
raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.")
|
|
||||||
|
|
@ -12,7 +12,7 @@ AVAILABLE_GFX_DRIVERS = {
|
||||||
},
|
},
|
||||||
'intel' : ['xf86-video-intel'],
|
'intel' : ['xf86-video-intel'],
|
||||||
'nvidia' : {
|
'nvidia' : {
|
||||||
'open source' : ['xf86-video-nouveau'],
|
'open-source' : ['xf86-video-nouveau'],
|
||||||
'proprietary' : ['nvidia']
|
'proprietary' : ['nvidia']
|
||||||
},
|
},
|
||||||
'mesa' : ['mesa'],
|
'mesa' : ['mesa'],
|
||||||
|
|
|
||||||
|
|
@ -412,15 +412,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
|
||||||
(The template xorg is for beginner users, not advanced, and should
|
(The template xorg is for beginner users, not advanced, and should
|
||||||
there for appeal to the general public first and edge cases later)
|
there for appeal to the general public first and edge cases later)
|
||||||
"""
|
"""
|
||||||
drivers = sorted(list(options))
|
if len(options) >= 1:
|
||||||
|
|
||||||
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')
|
lspci = sys_command(f'/usr/bin/lspci')
|
||||||
for line in lspci.trace_log.split(b'\r\n'):
|
for line in lspci.trace_log.split(b'\r\n'):
|
||||||
if b' vga ' in line.lower():
|
if b' vga ' in line.lower():
|
||||||
|
|
@ -429,37 +421,16 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
|
||||||
elif b'amd' in line.lower():
|
elif b'amd' in line.lower():
|
||||||
print(' ** AMD card detected, suggested driver: AMD / ATI **')
|
print(' ** AMD card detected, suggested driver: AMD / ATI **')
|
||||||
|
|
||||||
selected_driver = input('Select your graphics card driver: ')
|
selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True)
|
||||||
initial_option = selected_driver
|
initial_option = selected_driver
|
||||||
|
|
||||||
# Disabled search for now, only a few profiles exist anyway
|
if type(options[initial_option]) == dict:
|
||||||
#
|
driver_options = sorted(options[initial_option].keys())
|
||||||
#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:
|
selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ")
|
||||||
driver_options = sorted(list(selected_driver))
|
if selected_driver_package_group in options[initial_option].keys():
|
||||||
for index, driver_package_group in enumerate(driver_options):
|
print(options[initial_option][selected_driver_package_group])
|
||||||
print(f"{index}: {driver_package_group}")
|
selected_driver = options[initial_option][selected_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:
|
else:
|
||||||
raise RequirementError(f"Selected driver-type does not exist for {initial_option}.")
|
raise RequirementError(f"Selected driver-type does not exist for {initial_option}.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue