From 3023e5703370d7a53f47376205c2203db6b6fb98 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 10 Jun 2021 07:44:23 -0400 Subject: Add a message when running check_mirror_reachable to let users know it is not frozen. --- archinstall/lib/networking.py | 1 + 1 file changed, 1 insertion(+) (limited to 'archinstall') diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 64bcb58e..ded5ebe6 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -29,6 +29,7 @@ def list_interfaces(skip_loopback=True): def check_mirror_reachable(): + log("Testing connectivity to the Arch Linux mirrors ...", level=logging.INFO) if (exit_code := SysCommand("pacman -Sy").exit_code) == 0: return True elif os.geteuid() != 0: -- cgit v1.2.3-70-g09d2 From 2eec8ffd6cc661a9db67534abec0569a34cf6b94 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 10 Jun 2021 09:43:50 -0400 Subject: Clarify driver recommendations (#572) --- archinstall/lib/user_interaction.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 07b675a4..b8e1c35c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -11,7 +11,7 @@ import time from .exceptions import * from .general import SysCommand -from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi +from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi, has_amd_graphics, has_intel_graphics, has_nvidia_graphics from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, search_keyboard_layout from .networking import list_interfaces from .output import log @@ -702,12 +702,12 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): default_option = options["All open-source (default)"] if drivers: - for line in SysCommand('/usr/bin/lspci'): - 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 **') + if has_amd_graphics(): + print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.') + if has_intel_graphics(): + print('For the best compatibility with your Intel hardware, you may want to use either the all open-source or Intel options.') + if has_nvidia_graphics(): + print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.') initial_option = generic_select(drivers, input_text="Select your graphics card driver: ") -- cgit v1.2.3-70-g09d2 From 4e17355796b257ea6af306f6b3af3e8fb78f94e4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 13 Jun 2021 08:32:38 -0400 Subject: Implement is_desktop_profile helper function (#575) * Implement is_desktop_profile helper function * Make ask_for_audio_selection use generic_select * Fix default value for audio selection * Leverage list of supported desktops to perform is_desktop_profile check * is_desktop_profile was missing a default return value * Store return value for audio server --- archinstall/lib/profiles.py | 17 +++++++++++++++++ archinstall/lib/user_interaction.py | 13 +++++++------ examples/guided.py | 15 +++++---------- profiles/desktop.py | 32 ++++++++++++++++---------------- 4 files changed, 45 insertions(+), 32 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 8434a0ab..ebb08990 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -23,6 +23,23 @@ def grab_url_data(path): return response.read() +def is_desktop_profile(profile) -> bool: + if str(profile) == 'Profile(desktop)': + return True + + desktop_profile = Profile(None, "desktop") + with open(desktop_profile.path, 'r') as source: + source_data = source.read() + + if '__name__' in source_data and '__supported__' in source_data: + with desktop_profile.load_instructions(namespace=f"{desktop_profile.namespace}.py") as imported: + if hasattr(imported, '__supported__'): + desktop_profiles = imported.__supported__ + return str(profile) in [f"Profile({s})" for s in desktop_profiles] + + return False + + def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_profiles=False): # TODO: Grab from github page as well, not just local static files if filter_irrelevant_macs: diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b8e1c35c..6ef70aa2 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -372,11 +372,12 @@ def ask_for_bootloader() -> str: 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() - if pipewire_choice in ("y", ""): - audio = "pipewire" +def ask_for_audio_selection(desktop=True): + audio = 'pipewire' if desktop else 'none' + choices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', 'none'] + selection = generic_select(choices, f'Choose an audio server or leave blank to use {audio}: ', options_output=True) + if selection != "": + audio = selection return audio @@ -703,7 +704,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): if drivers: if has_amd_graphics(): - print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.') + print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.') if has_intel_graphics(): print('For the best compatibility with your Intel hardware, you may want to use either the all open-source or Intel options.') if has_nvidia_graphics(): diff --git a/examples/guided.py b/examples/guided.py index 266efbd4..647e78b1 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -7,7 +7,7 @@ import archinstall from archinstall.lib.general import run_custom_user_commands from archinstall.lib.hardware import * from archinstall.lib.networking import check_mirror_reachable -from archinstall.lib.profiles import Profile +from archinstall.lib.profiles import Profile, is_desktop_profile if archinstall.arguments.get('help'): print("See `man archinstall` for help.") @@ -212,13 +212,8 @@ 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() - else: - # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that. - # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues - archinstall.arguments['audio'] = None + # The argument to ask_for_audio_selection lets the library know if it's a desktop profile + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection(is_desktop_profile(archinstall.arguments['profile'])) # Ask for preferred kernel: if not archinstall.arguments.get("kernels", None): @@ -270,10 +265,10 @@ def perform_installation_steps(): with open("/var/log/archinstall/user_configuration.json", "w") as config_file: config_file.write(user_configuration) print() - + if archinstall.arguments.get('dry_run'): exit(0) - + if not archinstall.arguments.get('silent'): input('Press Enter to continue.') diff --git a/profiles/desktop.py b/profiles/desktop.py index 73df9256..c0710208 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -21,6 +21,21 @@ __packages__ = [ 'xdg-utils', ] +__supported__ = [ + 'gnome', + 'kde', + 'awesome', + 'sway', + 'cinnamon', + 'xfce4', + 'lxqt', + 'i3', + 'budgie', + 'mate', + 'deepin', + 'enlightenment', +] + def _prep_function(*args, **kwargs): """ @@ -30,22 +45,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = [ - 'gnome', - 'kde', - 'awesome', - 'sway', - 'cinnamon', - 'xfce4', - 'lxqt', - 'i3', - 'budgie', - 'mate', - 'deepin', - 'enlightenment', - ] - - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True) + desktop = archinstall.generic_select(__supported__, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded -- cgit v1.2.3-70-g09d2 From d30a22cae3e7a37d4141d3a6128e83fc3d47f9be Mon Sep 17 00:00:00 2001 From: Yash Tripathi Date: Sun, 13 Jun 2021 18:22:24 +0530 Subject: Setting proper keys in exported config (#557) * Set the resolved profile path to the actual desktop environment * split Nvidia driver list into proprietary and open-source * Updated select_driver to use archinstall.arguments for driver selection * Adding default value that works with later .get() * audio will now be prompted irrespective of profile --- archinstall/lib/user_interaction.py | 28 +++++++++------------------- profiles/desktop.py | 2 ++ 2 files changed, 11 insertions(+), 19 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 6ef70aa2..2c5810ae 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -16,7 +16,7 @@ from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, sea from .networking import list_interfaces from .output import log from .profiles import Profile, list_profiles - +from .storage import * # TODO: Some inconsistencies between the selection processes. # Some return the keys from the options, some the values? @@ -700,9 +700,9 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): """ drivers = sorted(list(options)) - default_option = options["All open-source (default)"] - + if drivers: + arguments = storage.get('arguments', {}) if has_amd_graphics(): print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.') if has_intel_graphics(): @@ -710,22 +710,12 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): if has_nvidia_graphics(): print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.') - initial_option = generic_select(drivers, input_text="Select your graphics card driver: ") - - if not initial_option: - return default_option - - selected_driver = options[initial_option] - - 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 + arguments['gfx_driver'] = generic_select(drivers, input_text="Select your graphics card driver: ") + + if arguments.get('gfx_driver', None) is None: + arguments['gfx_driver'] = "All open-source (default)" + + return options.get(arguments.get('gfx_driver')) raise RequirementError("Selecting drivers require a least one profile to be given as an option.") diff --git a/profiles/desktop.py b/profiles/desktop.py index c0710208..eaf145c2 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -54,6 +54,8 @@ def _prep_function(*args, **kwargs): archinstall.storage['_desktop_profile'] = desktop profile = archinstall.Profile(None, desktop) + # Set the resolved profile path to the actual desktop environment + archinstall.arguments['profile'] = profile # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. with profile.load_instructions(namespace=f"{desktop}.py") as imported: if hasattr(imported, '_prep_function'): -- cgit v1.2.3-70-g09d2