Pulled in master to avoid merge conflicts.

This commit is contained in:
Anton Hvornum 2021-04-10 11:22:15 +02:00
commit 8429510736
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
11 changed files with 92 additions and 58 deletions

View File

@ -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:

View File

@ -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))

View File

@ -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")

View File

@ -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")

View File

@ -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)

View File

@ -0,0 +1,3 @@
import archinstall
installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings")

34
profiles/budgie.py Normal file
View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()