index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-04-10 11:22:15 +0200 |
---|---|---|
committer | Anton Hvornum <anton@hvornum.se> | 2021-04-10 11:22:15 +0200 |
commit | 8429510736b0750510c4ac1d9f281755b195bb11 (patch) | |
tree | d82cdbb2af6545cf8eef80bf583fe507e588cb8e | |
parent | 48e801e6fdbc1f74885a3541011d4cce5876ab21 (diff) | |
parent | f1b42216a7393e58a02f2e885293efe88304cada (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 12 | ||||
-rw-r--r-- | examples/guided.py | 39 | ||||
-rw-r--r-- | profiles/applications/budgie.py | 4 | ||||
-rw-r--r-- | profiles/applications/cinnamon.py | 3 | ||||
-rw-r--r-- | profiles/applications/sway.py | 2 | ||||
-rw-r--r-- | profiles/applications/xfce4.py | 3 | ||||
-rw-r--r-- | profiles/budgie.py | 34 | ||||
-rw-r--r-- | profiles/desktop.py | 2 | ||||
-rw-r--r-- | profiles/i3-gaps.py | 17 | ||||
-rw-r--r-- | profiles/i3-wm.py | 17 | ||||
-rw-r--r-- | profiles/i3.py | 17 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index cb0fb012..16627794 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -139,15 +139,25 @@ 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 pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() + if pipewire_choice in ("y", ""): + audio = "pipewire" + + return audio 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 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 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)': while 1: diff --git a/examples/guided.py b/examples/guided.py index 79023012..beb577c8 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -162,18 +162,31 @@ def ask_user_questions(): ) exit(1) + # 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' + # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): print("Packages not part of the desktop environment are not installed by default.") 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)] - # Verify packages that were given - try: - archinstall.validate_package_list(archinstall.arguments['packages']) - except archinstall.RequirementError as e: - archinstall.log(e, fg='red') - exit(1) + if len(archinstall.arguments['packages']): + # Verify packages that were given + try: + archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") + archinstall.validate_package_list(archinstall.arguments['packages']) + except archinstall.RequirementError as e: + archinstall.log(e, fg='red') + exit(1) # Ask or Call the helper function that asks the user to optionally configure a network. if not archinstall.arguments.get('nic', None): @@ -275,14 +288,24 @@ def perform_installation(mountpoint): # 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('nic',{}).get('NetworkManager',False): + installation.add_additional_packages("networkmanager") + installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface elif archinstall.arguments.get('nic', None): installation.configure_nic(**archinstall.arguments.get('nic', {})) installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - + if archinstall.arguments.get('audio', None) != None: + installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + elif archinstall.arguments.get('audio', None) == 'pulseaudio': + print('Installing pulseaudio ...') + installation.add_additional_packages("pulseaudio") + 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/budgie.py b/profiles/applications/budgie.py new file mode 100644 index 00000000..8c5ea223 --- /dev/null +++ b/profiles/applications/budgie.py @@ -0,0 +1,4 @@ +import archinstall + +# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki +installation.add_additional_packages("budgie-desktop lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings gnome")
\ No newline at end of file diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py new file mode 100644 index 00000000..5e2ac02e --- /dev/null +++ b/profiles/applications/cinnamon.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings")
\ No newline at end of file diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py index c99f378a..56d7f318 100644 --- a/profiles/applications/sway.py +++ b/profiles/applications/sway.py @@ -1,3 +1,3 @@ import archinstall -packages = "sway swaylock swayidle dmenu alacritty" +packages = "sway swaylock swayidle waybar dmenu light grim slurp pavucontrol alacritty" installation.add_additional_packages(packages) diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py new file mode 100644 index 00000000..809d10d0 --- /dev/null +++ b/profiles/applications/xfce4.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings")
\ No newline at end of file diff --git a/profiles/budgie.py b/profiles/budgie.py new file mode 100644 index 00000000..6c5475ae --- /dev/null +++ b/profiles/budgie.py @@ -0,0 +1,34 @@ +# A desktop environment using "budgie" + +import archinstall + +is_top_level_profile = False + +def _prep_function(*args, **kwargs): + """ + Magic function called by the importing installer + before continuing any further. It also avoids executing any + other code in this stage. So it's a safe way to ask the user + for more input before any other installer steps start. + """ + + # budgie requires a functioning Xorg installation. + profile = archinstall.Profile(None, 'xorg') + with profile.load_instructions(namespace='xorg.py') as imported: + if hasattr(imported, '_prep_function'): + return imported._prep_function() + else: + print('Deprecated (??): xorg profile has no _prep_function() anymore') + +# Ensures that this code only gets executed if executed +# through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") +# or through conventional import budgie +if __name__ == 'budgie': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application budgie from the template under /applications/ + budgie = archinstall.Application(installation, 'budgie') + budgie.install() + + installation.enable_service('lightdm') # Light Display Manager diff --git a/profiles/desktop.py b/profiles/desktop.py index e2850da4..7b10f773 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,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'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py deleted file mode 100644 index ddca34b7..00000000 --- a/profiles/i3-gaps.py +++ /dev/null @@ -1,17 +0,0 @@ -import archinstall, subprocess - -is_top_level_profile = False - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - return True - -if __name__ == 'i3-gaps': - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-gaps') - i3.install() diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py deleted file mode 100644 index 4a0415fc..00000000 --- a/profiles/i3-wm.py +++ /dev/null @@ -1,17 +0,0 @@ -import archinstall, subprocess - -is_top_level_profile = False - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - return True - -if __name__ == 'i3-wm': - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-wm') - i3.install() diff --git a/profiles/i3.py b/profiles/i3.py index 9f58e7eb..bc6dc2ca 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -22,7 +22,7 @@ def _prep_function(*args, **kwargs): # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. - archinstall.storage['_desktop_profile'] = desktop + archinstall.storage['_i3_configuration'] = desktop # i3 requires a functioning Xorg installation. profile = archinstall.Profile(None, 'xorg') @@ -32,14 +32,6 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') - profile = archinstall.Profile(None, desktop) - # 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'): - return imported._prep_function() - else: - print(f"Deprecated (??): {desktop} profile has no _prep_function() anymore") - if __name__ == 'i3': """ This "profile" is a meta-profile. @@ -66,7 +58,6 @@ if __name__ == 'i3': # Auto start lightdm for all users installation.enable_service('lightdm') - # TODO: Remove magic variable 'installation' and place it - # in archinstall.storage or archinstall.session/archinstall.installation - installation.install_profile(archinstall.storage['_desktop_profile']) - + # install the i3 group now + i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) + i3.install() |