From fe237eac3ce29cd90f002cfb41a596e3f3830193 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 07:24:52 +0530 Subject: networkmanager support --- archinstall/lib/user_interaction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 80db7be1..37f06ae8 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -94,7 +94,7 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': @@ -119,9 +119,9 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s else: - return {'nic': nic} + return {'nic': nic,'NetworkManager':True} elif nic: return nic -- cgit v1.2.3-54-g00ecf From 454d712d088091af4818c2cd8638e2152bdd4d54 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:03:49 +0530 Subject: fixed typo --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 37f06ae8..c05a09ee 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -119,7 +119,7 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: return {'nic': nic,'NetworkManager':True} elif nic: -- cgit v1.2.3-54-g00ecf From f42d52624e19478bea0a57b03fb46119375714f2 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:08:17 +0530 Subject: moved around the if block --- archinstall/lib/user_interaction.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index c05a09ee..83e59e90 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -98,6 +98,8 @@ def ask_to_configure_network(): nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': + if nic == 'Use NetworkManager to control and manage you internet conntetion': + return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': while 1: @@ -121,7 +123,7 @@ def ask_to_configure_network(): return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: - return {'nic': nic,'NetworkManager':True} + return {'nic': nic} elif nic: return nic -- cgit v1.2.3-54-g00ecf From 9daa3f49242227e0cc6c2272b9322578edaab644 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:26:28 +0530 Subject: fixed some typos and changed up how we detect if we have to enable/install network manager --- archinstall/lib/user_interaction.py | 4 ++-- examples/guided.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 83e59e90..f8b4d9c5 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -94,11 +94,11 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage your internet connection', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': - if nic == 'Use NetworkManager to control and manage you internet conntetion': + if nic == 'Use NetworkManager to control and manage your internet connection': return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': diff --git a/examples/guided.py b/examples/guided.py index 5ca45008..1e077169 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -317,7 +317,7 @@ def perform_installation(device, boot_partition, language, mirrors): # Perform a copy of the config if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('NetworkManager',None) == True: + elif archinstall.arguments.get('nic',None) == 'Use NetworkManager to control and manage your internet connection': installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface -- cgit v1.2.3-54-g00ecf From d9984550b6ad4f4e7d659adb32cef541e85d69d9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 18:04:03 -0400 Subject: Move choice into guided installation instead of DEs Arch wiki says packages should enable the user services automatically --- archinstall/lib/user_interaction.py | 8 ++++++++ examples/guided.py | 10 +++++++++- profiles/applications/pipewire.py | 4 ++-- profiles/awesome.py | 6 ------ profiles/cinnamon.py | 6 ------ profiles/gnome.py | 6 ------ profiles/i3-gaps.py | 8 +------- profiles/i3-wm.py | 6 ------ profiles/kde.py | 6 ------ profiles/xfce4.py | 6 ------ 10 files changed, 20 insertions(+), 46 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 58f88bd2..3c5115ea 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -89,6 +89,14 @@ def ask_for_a_timezone(): level=LOG_LEVELS.Warning, fg='red' ) + +def ask_for_audio_selection(): + audio = "pulseaudio" # Default for most desktop environments + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if pipewire_choice == "y": + audio = "pipewire" + + return audio def ask_to_configure_network(): # Optionally configure one network interface. diff --git a/examples/guided.py b/examples/guided.py index 81cc2991..cd45bef5 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -182,6 +182,10 @@ def ask_user_questions(): ) exit(1) + # Ask about audio server selection (this right now just asks for pipewire and defaults to pulseaudio otherwise) + if not archinstall.arguments.get('audio', None): + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] @@ -329,7 +333,11 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - + print('This audio server will be used: ' + archinstall.arguments.get('audio', None)) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.install_profile('pipewire') + if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py index 2d9f6a6c..aea5b50d 100644 --- a/profiles/applications/pipewire.py +++ b/profiles/applications/pipewire.py @@ -1,5 +1,5 @@ import archinstall -__packages__ = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] +packages = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] -installation.add_additional_packages(__packages__) +installation.add_additional_packages(packages) diff --git a/profiles/awesome.py b/profiles/awesome.py index fcad1839..8004fc62 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -25,12 +25,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py") # or through conventional import awesome if __name__ == 'awesome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install the application awesome from the template under /applications/ awesome = archinstall.Application(installation, 'awesome') awesome.install() diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index a3225c30..dac38bd3 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -22,12 +22,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon if __name__ == 'cinnamon': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/gnome.py b/profiles/gnome.py index d13e6eee..63fcd57d 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -23,12 +23,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome if __name__ == 'gnome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index f75dfb11..50511dce 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -29,13 +29,7 @@ def _post_install(*args, **kwargs): return True -if __name__ == 'i3-wm': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - +if __name__ == 'i3-wm': # Install dependency profiles installation.install_profile('xorg') # gaps is installed by deafult so we are overriding it here diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 6d40065c..cd6cbc81 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -29,12 +29,6 @@ def _post_install(*args, **kwargs): return True if __name__ == 'i3-wm': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') # we are installing lightdm to auto start i3 diff --git a/profiles/kde.py b/profiles/kde.py index dabba57b..0207ed22 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -32,12 +32,6 @@ def _post_install(*args, **kwargs): # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde if __name__ == 'kde': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 8e418578..36c9958a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -23,12 +23,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 if __name__ == 'xfce4': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-54-g00ecf From 50c354471f4c27b0c30153902802fb396c76f2b0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 09:29:50 +0200 Subject: Change phrasing to indicate pulseaudio as default --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3c5115ea..4ab9b9a9 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -92,7 +92,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() if pipewire_choice == "y": audio = "pipewire" -- cgit v1.2.3-54-g00ecf From f4233e73f0b70f236a9fd357ee11bf194224a4fb Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 21:31:28 -0400 Subject: Assume yes is the user's intention if empty response for pipewire prompt --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index c5ff17ca..b94bf3f5 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -107,7 +107,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() - if pipewire_choice == "y": + if pipewire_choice in ("y", ""): audio = "pipewire" return audio -- cgit v1.2.3-54-g00ecf From 1292c07796b763b926fd5edb21905a663eaef8f0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 11 Apr 2021 10:20:33 +0200 Subject: Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. --- archinstall/lib/hardware.py | 19 +++++++++++ archinstall/lib/installer.py | 1 - archinstall/lib/user_interaction.py | 67 +++++++++++++++++++++++++++++++++++++ profiles/sway.py | 2 +- profiles/xorg.py | 2 +- 5 files changed, 88 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/user_interaction.py') 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. -- cgit v1.2.3-54-g00ecf From 87ca382f6c69bfbf7d7db73e179b37ec008cbdf7 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sun, 11 Apr 2021 21:34:31 -0400 Subject: Use generic_select for GPU driver Make it so there isn't a space in the key Try to simplify things more --- archinstall/lib/gfx_drivers.py | 84 ------------------------------------- archinstall/lib/hardware.py | 2 +- archinstall/lib/user_interaction.py | 49 +++++----------------- 3 files changed, 11 insertions(+), 124 deletions(-) delete mode 100644 archinstall/lib/gfx_drivers.py (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/gfx_drivers.py b/archinstall/lib/gfx_drivers.py deleted file mode 100644 index e1fb2824..00000000 --- a/archinstall/lib/gfx_drivers.py +++ /dev/null @@ -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.") \ No newline at end of file diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 047b3491..d6cf982c 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -12,7 +12,7 @@ AVAILABLE_GFX_DRIVERS = { }, 'intel' : ['xf86-video-intel'], 'nvidia' : { - 'open source' : ['xf86-video-nouveau'], + 'open-source' : ['xf86-video-nouveau'], 'proprietary' : ['nvidia'] }, 'mesa' : ['mesa'], diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 425dc9a9..114c7c6a 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -412,15 +412,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): (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. --') - + if len(options) >= 1: lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -429,37 +421,16 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): 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 - # 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.") + if type(options[initial_option]) == dict: + driver_options = sorted(options[initial_option].keys()) + + selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ") + if selected_driver_package_group in options[initial_option].keys(): + print(options[initial_option][selected_driver_package_group]) + selected_driver = options[initial_option][selected_driver_package_group] else: raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") @@ -467,4 +438,4 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver - raise RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") -- cgit v1.2.3-54-g00ecf From c63d2140a46ee4001f855a575499cd51b7d0c0ee Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 17 Apr 2021 09:59:51 +0200 Subject: Removed merge artifact. --- archinstall/lib/user_interaction.py | 1 - 1 file changed, 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 82ddab7a..822f63be 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -411,7 +411,6 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): raise RequirementError("Selected region does not exist.") return selected_mirrors -<<<<<<< HEAD raise RequirementError("Selecting mirror region require a least one region to be given as an option.") -- cgit v1.2.3-54-g00ecf From 7afba65c261057808fae8e3cb22ddd89fed31f2b Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 18:43:19 +0530 Subject: rebase --- archinstall/lib/user_interaction.py | 14 ++++++++++++-- examples/guided.py | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 822f63be..9d09d8f1 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,7 +7,7 @@ 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 +from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -143,7 +143,17 @@ def ask_for_a_timezone(): level=LOG_LEVELS.Warning, fg='red' ) - + +def ask_for_bootloader() -> str: + bootloader = "systemd-bootctl" + if hasUEFI==False: + bootloader="grub-install" + else: + bootloader_choice = input("Would you like to use Grub as a bootloader over systemd-boot [y/N] ").lower() + if bootloader_choice == "y": + bootloader="grub-install" + return bootloader + def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() diff --git a/examples/guided.py b/examples/guided.py index c86f2b4b..643e2c94 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -64,6 +64,8 @@ def ask_user_questions(): partition_mountpoints[partition] = None except archinstall.UnknownFilesystemFormat as err: archinstall.log(f" {partition} (Filesystem not supported)", fg='red') + + archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader() # We then ask what to do with the partitions. if (option := archinstall.ask_for_disk_layout()) == 'abort': @@ -190,7 +192,7 @@ def ask_user_questions(): # Additional packages (with some light weight error handling for invalid package names) while True: if not archinstall.arguments.get('packages', None): - print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.") + print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr(in uefi systems) and optional profile packages are installed.") print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] @@ -303,7 +305,8 @@ def perform_installation(mountpoint): # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium - + if hasUEFI()==False: + installation.base_packages.replace("efibootmgr","")# if we aren't on a uefi system why install efibootmgr if installation.minimal_installation(): installation.set_hostname(archinstall.arguments['hostname']) if archinstall.arguments['mirror-region'].get("mirrors",{})!= None: -- cgit v1.2.3-54-g00ecf From 264db25eefd09a99ecdfa5f095b49343fc143d82 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:50:12 +0530 Subject: call hasUEFI --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 9d09d8f1..818590dd 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -146,7 +146,7 @@ def ask_for_a_timezone(): def ask_for_bootloader() -> str: bootloader = "systemd-bootctl" - if hasUEFI==False: + if hasUEFI()==False: bootloader="grub-install" else: bootloader_choice = input("Would you like to use Grub as a bootloader over systemd-boot [y/N] ").lower() -- cgit v1.2.3-54-g00ecf From 8b723c25e2c487c508d2718b06381ca6c2b7d2a0 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 20:36:26 +0530 Subject: changed some strings --- archinstall/lib/user_interaction.py | 2 +- examples/guided.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 818590dd..175079ee 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -149,7 +149,7 @@ def ask_for_bootloader() -> str: if hasUEFI()==False: bootloader="grub-install" else: - bootloader_choice = input("Would you like to use Grub as a bootloader over systemd-boot [y/N] ").lower() + bootloader_choice = input("Would you like to use GRUB as a bootloader instead off systemd-boot [y/N] ").lower() if bootloader_choice == "y": bootloader="grub-install" return bootloader diff --git a/examples/guided.py b/examples/guided.py index 8308d22c..3d357e2d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -191,7 +191,7 @@ def ask_user_questions(): # Additional packages (with some light weight error handling for invalid package names) while True: if not archinstall.arguments.get('packages', None): - print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr(on uefi systems)/grub(on bios systems) and optional profile packages are installed.") + print("Only packages such as base, base-devel, linux, linux-firmware, efibootmgr (on UEFI systems)/GRUB (on BIOS systems) and optional profile packages are installed.") print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] -- cgit v1.2.3-54-g00ecf From 63a94a57708bdfb4cdfde0c24af2d324ba191beb Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 22:09:27 +0530 Subject: add efibootmgr only on uefi systems --- archinstall/lib/installer.py | 8 +++++--- archinstall/lib/user_interaction.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 10a9ad4b..f6c891a3 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -39,7 +39,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages='base base-devel linux linux-firmware efibootmgr'): + def __init__(self, target, *, base_packages='base base-devel linux linux-firmware'): self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) @@ -50,8 +50,10 @@ class Installer(): } self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages - if hasUEFI() == False: - self.base_packages.pop(self.base_packages.index("efibootmgr")) + if hasUEFI(): + self.base_packages.append("efibootmgr") + else: + self.base_packages.append("grub") self.post_base_install = [] storage['session'] = self diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 175079ee..70ff7a1e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -149,7 +149,7 @@ def ask_for_bootloader() -> str: if hasUEFI()==False: bootloader="grub-install" else: - bootloader_choice = input("Would you like to use GRUB as a bootloader instead off systemd-boot [y/N] ").lower() + bootloader_choice = input("Would you like to use GRUB as a bootloader instead of systemd-boot? [y/N] ").lower() if bootloader_choice == "y": bootloader="grub-install" return bootloader -- cgit v1.2.3-54-g00ecf From eb1ff72f5ba627e09da820b1ce0970d361653eca Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 17:00:51 +0530 Subject: readded some commits that got removed --- archinstall/lib/user_interaction.py | 54 ++++++++++++++++++++++++++++ profiles/sway.py | 6 ++++ profiles/xorg.py | 70 ------------------------------------- 3 files changed, 60 insertions(+), 70 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b0d8e138..d8d2df18 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,7 +7,11 @@ from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces from .general import sys_command +<<<<<<< HEAD from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI +======= +from .hardware import AVAILABLE_GFX_DRIVERS +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -465,7 +469,19 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): (The template xorg is for beginner users, not advanced, and should there for appeal to the general public first and edge cases later) """ +<<<<<<< HEAD if len(options) >= 1: +======= + 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. --') + +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -474,6 +490,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') +<<<<<<< HEAD selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True) initial_option = selected_driver @@ -484,6 +501,39 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): if selected_driver_package_group in options[initial_option].keys(): print(options[initial_option][selected_driver_package_group]) selected_driver = options[initial_option][selected_driver_package_group] +======= + 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.") +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. else: raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") @@ -491,4 +541,8 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver +<<<<<<< HEAD + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") +======= raise RequirementError("Selecting drivers require a least one profile to be given as an option.") +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. diff --git a/profiles/sway.py b/profiles/sway.py index 5633cce2..7fb64fd7 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,6 +11,12 @@ 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. """ +<<<<<<< HEAD +======= + + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() + +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. return True # Ensures that this code only gets executed if executed diff --git a/profiles/xorg.py b/profiles/xorg.py index 8e9779bc..4d54fe79 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -5,76 +5,6 @@ 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 -- cgit v1.2.3-54-g00ecf From e63eb26388eee05ba625b55ae1a1883e9ea340c1 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 17:03:24 +0530 Subject: fixed merge conflicts --- archinstall/lib/user_interaction.py | 25 ------------------------- profiles/sway.py | 3 --- 2 files changed, 28 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index d8d2df18..befcb6d1 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,11 +7,7 @@ from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces from .general import sys_command -<<<<<<< HEAD -from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI -======= from .hardware import AVAILABLE_GFX_DRIVERS ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -469,9 +465,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): (The template xorg is for beginner users, not advanced, and should there for appeal to the general public first and edge cases later) """ -<<<<<<< HEAD - if len(options) >= 1: -======= drivers = sorted(list(options)) if len(drivers) >= 1: @@ -481,7 +474,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): print(' -- The above list are supported graphic card drivers. --') print(' -- You need to select (and read about) which one you need. --') ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -490,18 +482,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') -<<<<<<< HEAD - selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True) - initial_option = selected_driver - - if type(options[initial_option]) == dict: - driver_options = sorted(options[initial_option].keys()) - - selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ") - if selected_driver_package_group in options[initial_option].keys(): - print(options[initial_option][selected_driver_package_group]) - selected_driver = options[initial_option][selected_driver_package_group] -======= selected_driver = input('Select your graphics card driver: ') initial_option = selected_driver @@ -533,7 +513,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): 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.") ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. else: raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") @@ -541,8 +520,4 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver -<<<<<<< HEAD - raise RequirementError("Selecting drivers require a least one profile to be given as an option.") -======= raise RequirementError("Selecting drivers require a least one profile to be given as an option.") ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. diff --git a/profiles/sway.py b/profiles/sway.py index 7fb64fd7..53eb8c5a 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,12 +11,9 @@ 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. """ -<<<<<<< HEAD -======= __builtins__['_gfx_driver_packages'] = archinstall.select_driver() ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. return True # Ensures that this code only gets executed if executed -- cgit v1.2.3-54-g00ecf From 1c0c1277624aae89bf9cba6940dcc69fb152be81 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 19:13:57 +0530 Subject: has uefi was removed from user_interactions --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 7e0a62ba..83c5e5cd 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,7 +7,7 @@ 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 +from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? -- cgit v1.2.3-54-g00ecf From 5c9859d316b8064949370c03745cfd99e0d67670 Mon Sep 17 00:00:00 2001 From: Aggam Rahamim Date: Sun, 25 Apr 2021 14:55:39 +0300 Subject: having ability to use multiple kernels --- archinstall/lib/installer.py | 4 ++-- archinstall/lib/user_interaction.py | 4 +++- examples/guided.py | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7f6311c9..d952a6ed 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -34,8 +34,8 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages=' base base-devel linux-firmware efibootmgr', kernel='linux'): - base_packages = kernel + base_packages + def __init__(self, target, *, base_packages='base base-devel linux-firmware efibootmgr ', kernels='linux'): + base_packages = base_packages + kernels.replace(',', ' ') self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 99cf6274..3da24684 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -218,6 +218,8 @@ def generic_select(options, input_text="Select one of the above by index or abso 1: first 2: second 3: third option + + it will return the selected text. """ if type(options) == dict: options = list(options) @@ -263,7 +265,7 @@ def select_disk(dict_o_disks): elif drive.isdigit(): drive = int(drive) if drive >= len(drives): - raise DiskError(f'Selected option "{drive}" is out of range') + raise Dis1ror(f'Selected option "{drive}" is out of range') drive = dict_o_disks[drives[drive]] elif drive in dict_o_disks: drive = dict_o_disks[drive] diff --git a/examples/guided.py b/examples/guided.py index e6abe872..ee7b63d9 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -2,6 +2,7 @@ import getpass, time, json, os import archinstall from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile +from archinstall.lib.user_interaction import generic_select if hasUEFI() is False: log("ArchInstall currently only supports machines booted with UEFI. MBR & GRUB support is coming in version 2.2.0!", fg="red", level=archinstall.LOG_LEVELS.Error) @@ -168,7 +169,6 @@ def ask_user_questions(): # Ask about audio server selection if one is not already set if not archinstall.arguments.get('audio', None): - # only ask for audio server selection on a desktop profile if str(archinstall.arguments['profile']) == 'Profile(desktop)': archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() @@ -178,12 +178,15 @@ def ask_user_questions(): archinstall.arguments['audio'] = None # Ask what kernel user wants: - kernel = input("1. linux\n2. linux-lts\n3. linux-zen\nchoose a kernel of the following: ") - try: - archinstall.arguments['kernel'] = ['linux', 'linux-lts', 'linux-zen'][int(kernel) - 1] - except: - archinstall.log('invalid kernel selected. defaulting to \'linux\'.') - archinstall.arguments['kernel'] = 'linux' + while True: + kernel = generic_select(["linux", "linux-lts", "linux-zen", "continue"], "choose a kernel:") + if (archinstall.arguments['kernels'] == None or archinstall.arguments['kernels'] == ""): + archinstall.arguments['kernels'] = kernel + else: + if (kernel == "continue"): + break + archinstall.arguments['kernels'] += "," + kernel + # Additional packages (with some light weight error handling for invalid package names) @@ -281,7 +284,7 @@ def perform_installation(mountpoint): Only requirement is that the block devices are formatted and setup prior to entering this function. """ - with archinstall.Installer(mountpoint, kernel=archinstall.arguments['kernel']) as installation: + with archinstall.Installer(mountpoint, kernels=archinstall.arguments['kernels']) as installation: ## if len(mirrors): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist -- cgit v1.2.3-54-g00ecf From 847cb3d032498e03f27b9bffede04faa5ac4361f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 27 Apr 2021 12:27:49 +0200 Subject: Spelling error --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b93f88b3..f801ec83 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -267,7 +267,7 @@ def select_disk(dict_o_disks): elif drive.isdigit(): drive = int(drive) if drive >= len(drives): - raise Dis1ror(f'Selected option "{drive}" is out of range') + raise DiskError(f'Selected option "{drive}" is out of range') drive = dict_o_disks[drives[drive]] elif drive in dict_o_disks: drive = dict_o_disks[drive] -- cgit v1.2.3-54-g00ecf From 19c928df6ae7f6bf700817d5d709c8918bf3d411 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 27 Apr 2021 13:35:14 +0200 Subject: Forgot to hit save after merge conflict fixes. --- archinstall/lib/user_interaction.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 91ed5ed9..bd9d432d 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -259,20 +259,12 @@ def generic_select(options, input_text="Select one of the above by index or abso other than the options and their indexes. As an example: generic_select(["first", "second", "third option"]) -<<<<<<< HEAD 0: first 1: second 2: third option When the user has entered the option correctly, this function returns an item from list, a string, or None -======= - 1: first - 2: second - 3: third option - - it will return the selected text. ->>>>>>> 831f5e4eaf66f6f1a2aed04932af064ce9314dd4 """ # Checking if options are different from `list` or `dict` -- cgit v1.2.3-54-g00ecf