index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds@gmail.com> | 2021-06-14 09:26:03 +0200 |
---|---|---|
committer | Anton Hvornum <anton.feeds@gmail.com> | 2021-06-14 09:26:03 +0200 |
commit | d4f0d411f6b96ad29d367e84af6502794a92a7d9 (patch) | |
tree | 419a095de16b9a24bcb95db186f1b6f0b5f23d5f /archinstall | |
parent | 1450387fae158610dfe40a489579951ce071c260 (diff) | |
parent | 8489137b878aa920c3b6e9c567146f2c95d7981b (diff) |
-rw-r--r-- | archinstall/lib/networking.py | 1 | ||||
-rw-r--r-- | archinstall/lib/profiles.py | 17 | ||||
-rw-r--r-- | archinstall/lib/user_interaction.py | 54 |
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: 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 f85bf64f..17a91332 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -12,11 +12,12 @@ import time from .disk import BlockDevice, valid_fs_type, find_partition_by_mountpoint, suggest_single_disk_layout, suggest_multi_disk_layout 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 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? @@ -389,11 +390,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 @@ -906,32 +908,22 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): """ drivers = sorted(list(options)) - 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 **') - - 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 = 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(): + 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.') + + 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.") |