Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorDylan M. Taylor <dylan@dylanmtaylor.com>2021-06-13 08:32:38 -0400
committerGitHub <noreply@github.com>2021-06-13 14:32:38 +0200
commit4e17355796b257ea6af306f6b3af3e8fb78f94e4 (patch)
tree69c6e2a0194f447307280a81eacd8f527bae2b94 /archinstall/lib
parentb9af735d858dc2400fe7070f5c11c07c29dd3734 (diff)
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
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/profiles.py17
-rw-r--r--archinstall/lib/user_interaction.py13
2 files changed, 24 insertions, 6 deletions
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():