From 850fd2efa812508e2df67aa2b50cff8820389a0d Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 11:30:32 +0530 Subject: Started work on BIOS support --- profiles/52-54-00-12-34-56.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index 679c6721..ed2c9d78 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -11,7 +11,7 @@ archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_error harddrive = archinstall.all_disks()['/dev/sda'] disk_password = '1234' -with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: +with archinstall.Filesystem(harddrive) as fs: # Use the entire disk instead of setting up partitions on your own fs.use_entire_disk('luks2') -- cgit v1.2.3-70-g09d2 From 99dd9b1fb7856b864d816119f0742950941e97a8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 25 Mar 2021 15:07:49 +0100 Subject: New feature: Profile() now supports .packages which returns any defined packages for that specific profile, as well as archinstall.__packages__ contain any packages that Installer() is responsible for. This can be used to quickly gather any required packages and dependencies by archinstall. Not all profiles have it yet, so .packages might return None. --- archinstall/__init__.py | 2 +- archinstall/lib/installer.py | 6 +++++- archinstall/lib/profiles.py | 22 ++++++++++++++++++++++ profiles/applications/awesome.py | 6 +++--- profiles/awesome.py | 10 ++-------- 5 files changed, 33 insertions(+), 13 deletions(-) (limited to 'profiles') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index d4452d38..91cf17be 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -2,7 +2,7 @@ from .lib.general import * from .lib.disk import * from .lib.user_interaction import * from .lib.exceptions import * -from .lib.installer import * +from .lib.installer import __packages__, __base_packages__, Installer from .lib.profiles import * from .lib.luks import * from .lib.mirrors import * diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2200db8e..c31ade84 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -10,6 +10,10 @@ from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage +# Any package that the Installer() is responsible for (optional and the default ones) +__packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] +__base_packages__ = __packages__[:6] + class Installer(): """ `Installer()` is the wrapper for most basic installation steps. @@ -34,7 +38,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr nano', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): + def __init__(self, partition, boot_partition, *, base_packages=__base_packages__, profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): self.profile = profile self.hostname = hostname self.mountpoint = mountpoint diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 08b1d618..8198ff11 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -178,6 +178,28 @@ class Profile(Script): return True return False + @property + def packages(self) -> list: + """ + Returns a list of packages baked into the profile definition. + If no package definition has been done, .packages() will return None. + """ + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check before importing. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '__packages__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__packages__'): + return imported.__packages__ + return None + + class Application(Profile): def __repr__(self, *args, **kwargs): return f'Application({os.path.basename(self.profile)})' diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py index 578f246e..b8d779c0 100644 --- a/profiles/applications/awesome.py +++ b/profiles/applications/awesome.py @@ -1,10 +1,10 @@ import archinstall +__packages__ = ["awesome", "xorg-xrandr", "xterm", "feh", "slock", "terminus-font", "gnu-free-fonts", "ttf-liberation", "xsel"] + installation.install_profile('xorg') -installation.add_additional_packages( - "awesome xorg-xrandr xterm feh slock terminus-font gnu-free-fonts ttf-liberation xsel" -) +installation.add_additional_packages(__packages__) with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'r') as xinitrc: xinitrc_data = xinitrc.read() diff --git a/profiles/awesome.py b/profiles/awesome.py index b914b175..8004fc62 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -2,6 +2,7 @@ import archinstall +__packages__ = ['nano', 'nemo', 'gpicview-gtk3', 'chromium', 'openssh', 'sshfs', 'htop', 'scrot', 'wget'] def _prep_function(*args, **kwargs): """ @@ -28,14 +29,7 @@ if __name__ == 'awesome': awesome = archinstall.Application(installation, 'awesome') awesome.install() - # Then setup and configure the desktop environment: awesome - editor = "nano" - filebrowser = "nemo gpicview-gtk3" - webbrowser = "chromium" # TODO: Ask the user to select one instead - utils = "openssh sshfs htop scrot wget" - - - installation.add_additional_packages(f"{webbrowser} {utils} {filebrowser} {editor}") + installation.add_additional_packages(__packages__) alacritty = archinstall.Application(installation, 'alacritty') alacritty.install() -- cgit v1.2.3-70-g09d2 From 6446670ed4f23858626889b3f3391153d3f01021 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:17:51 -0400 Subject: xfce4 --- profiles/xfce4.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 profiles/xfce4.py (limited to 'profiles') diff --git a/profiles/xfce4.py b/profiles/xfce4.py new file mode 100644 index 00000000..040f29bd --- /dev/null +++ b/profiles/xfce4.py @@ -0,0 +1,34 @@ + +# A desktop environment using "Xfce4" + +import archinstall + +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. + """ + + # Gnome optionally supports xorg, we'll install it since it also + # includes graphic driver setups (this might change in the future) + 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("xfce4", "/somewhere/xfce4.py") +# or through conventional import gnome +if __name__ == 'xfce4': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application xfce4 from the template under /applications/ + xfce = archinstall.Application(installation, 'xfce4') + xfce.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From dcdd66fd29676709e9205b7983ca2ca7e882db62 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:19:23 -0400 Subject: applications/xfce4 --- profiles/applications/xfce4.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 profiles/applications/xfce4.py (limited to 'profiles') diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py new file mode 100644 index 00000000..74bf5990 --- /dev/null +++ b/profiles/applications/xfce4.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("xfce4 xfce4-goodies lightdm") # We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-70-g09d2 From 1342a1ae75dea094d1cc8f6cfb420cdaa4d4cdc1 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 17:57:19 -0400 Subject: Update desktop.py --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/desktop.py b/profiles/desktop.py index 869cf0a0..331adf59 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -10,7 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome'] + supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarly store the selected desktop profile -- cgit v1.2.3-70-g09d2 From 77c30fcb04599c631511943871f491d706a2d540 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 17:58:25 -0400 Subject: Update xfce4.py --- profiles/xfce4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 040f29bd..1cc4a62d 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -22,7 +22,7 @@ def _prep_function(*args, **kwargs): # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") -# or through conventional import gnome +# or through conventional import xfce4 if __name__ == 'xfce4': # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-70-g09d2 From 107c1d6caac6880212ac2b97152864b2916f8cd8 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 12:57:24 -0400 Subject: Create cinnamon.py --- profiles/cinnamon.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 profiles/cinnamon.py (limited to 'profiles') diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py new file mode 100644 index 00000000..e9c5d085 --- /dev/null +++ b/profiles/cinnamon.py @@ -0,0 +1,33 @@ +# A desktop environment using "Cinnamon" + +import archinstall + +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. + """ + + # Cinnamon optionally supports xorg, we'll install it since it also + # includes graphic driver setups (this might change in the future) + 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("cinnamon", "/somewhere/cinnamon.py") +# or through conventional import cinnamon +if __name__ == 'cinnamon': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application cinnamon from the template under /applications/ + cinnamon = archinstall.Application(installation, 'cinnamon') + cinnamon.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From 9576486cfa6155a80a8fca833e27b3016dae7e37 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 12:58:05 -0400 Subject: added cinnamon --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/desktop.py b/profiles/desktop.py index 331adf59..0c89e543 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -10,7 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4'] + supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarly store the selected desktop profile -- cgit v1.2.3-70-g09d2 From 771087e75b27cc433e98df986ac52e8f09d41f0a Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:38:10 -0400 Subject: applications/cinnamon --- profiles/applications/cinnamon.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 profiles/applications/cinnamon.py (limited to 'profiles') diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py new file mode 100644 index 00000000..af1cbee2 --- /dev/null +++ b/profiles/applications/cinnamon.py @@ -0,0 +1,4 @@ +import archinstall + +installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") +# We'll create a cinnamon-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-70-g09d2 From f72d3039f76b7cf080a42cd82ee99f1c30c906b7 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:49:37 -0400 Subject: add lightdm-gtk-greeter --- profiles/applications/xfce4.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py index 74bf5990..6d6f8f7c 100644 --- a/profiles/applications/xfce4.py +++ b/profiles/applications/xfce4.py @@ -1,3 +1,4 @@ import archinstall -installation.add_additional_packages("xfce4 xfce4-goodies lightdm") # We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") +# We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-70-g09d2 From 4c0c95a88cca796fa5f27ef53812348a1bc32624 Mon Sep 17 00:00:00 2001 From: advaithm Date: Mon, 5 Apr 2021 20:46:09 +0530 Subject: add i3-wm and i3-gaps support --- profiles/applications/i3-gaps.py | 2 ++ profiles/applications/i3-wm.py | 2 ++ profiles/i3-gaps.py | 28 ++++++++++++++++++++++++++++ profiles/i3-wm.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 profiles/applications/i3-gaps.py create mode 100644 profiles/applications/i3-wm.py create mode 100644 profiles/i3-gaps.py create mode 100644 profiles/i3-wm.py (limited to 'profiles') diff --git a/profiles/applications/i3-gaps.py b/profiles/applications/i3-gaps.py new file mode 100644 index 00000000..4dd95989 --- /dev/null +++ b/profiles/applications/i3-gaps.py @@ -0,0 +1,2 @@ +import archinstall +installation.add_additional_packages("i3lock i3status i3blocks i3-gaps") \ No newline at end of file diff --git a/profiles/applications/i3-wm.py b/profiles/applications/i3-wm.py new file mode 100644 index 00000000..8662497d --- /dev/null +++ b/profiles/applications/i3-wm.py @@ -0,0 +1,2 @@ +import archinstall +installation.add_additional_packages("i3lock i3status i3blocks i3-wm") \ No newline at end of file diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py new file mode 100644 index 00000000..bf8227ba --- /dev/null +++ b/profiles/i3-gaps.py @@ -0,0 +1,28 @@ +import archinstall + +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. + """ + + # KDE 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') + +if __name__ == 'i3-wm': + # Install dependency profiles + installation.install_profile('xorg') + # gaps is installed by deafult so we are overriding it here + installation.add_additional_packages("lightdm-gtk-greeter lightdm") + # install the i3 group now + i3 = archinstall.Application(installation, 'i3-gaps') + i3.install() + # Auto start lightdm for all users + installation.enable_service('lightdm') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py new file mode 100644 index 00000000..168abb72 --- /dev/null +++ b/profiles/i3-wm.py @@ -0,0 +1,28 @@ +import archinstall + +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. + """ + + # KDE 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') + +if __name__ == 'i3-wm': + # Install dependency profiles + installation.install_profile('xorg') + # we are installing lightdm to auto start i3 + installation.add_additional_packages("lightdm-gtk-greeter lightdm") + # install the i3 group now + i3 = archinstall.Application(installation, 'i3-wm') + i3.install() + # Auto start lightdm for all users + installation.enable_service('lightdm') \ No newline at end of file -- cgit v1.2.3-70-g09d2 From f0e40f56765156aff22cb270b28aa15c5547534f Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 07:21:11 +0530 Subject: added _post_install hook. --- archinstall/lib/profiles.py | 15 +++++++++++++++ examples/guided.py | 14 ++++++++++---- profiles/i3-gaps.py | 10 +++++++++- profiles/i3-wm.py | 9 ++++++++- 4 files changed, 42 insertions(+), 6 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 08b1d618..77c9c6b2 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,21 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check and if so, check if it's got a _prep_function() + # we can call to ask for more user input. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '_post_install' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '_post_install'): + return True class Application(Profile): def __repr__(self, *args, **kwargs): diff --git a/examples/guided.py b/examples/guided.py index 032a1f39..3f11b7a8 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,4 @@ -import getpass, time, json, sys, signal, os, subprocess +import getpass, time, json, sys, signal, os import archinstall from archinstall.lib.hardware import hasUEFI @@ -344,9 +344,15 @@ def perform_installation(device, boot_partition, language, mirrors): if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): installation.user_set_pw('root', root_pw) - if archinstall.arguments.get('profile', None) == "i3-wm" or archinstall.arguments.get('profile', None) == "i3-gaps": - print("the installation of i3/i3-gaps does not conatain any configuerations for the wm. in this shell you should add your configuerations") - subprocess.check_call("arch-chroot /mnt",shell=True) + if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_post_install(): + with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported: + if not imported._post_install(): + archinstall.log( + ' * Profile\'s preparation requirements was not fulfilled.', + bg='black', + fg='red' + ) + exit(1) ask_user_questions() perform_installation_steps() diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index bf8227ba..d9469dcd 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -1,4 +1,4 @@ -import archinstall +import archinstall, subprocess def _prep_function(*args, **kwargs): """ @@ -16,6 +16,14 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + """ + Another magic function called after the system + has been installed. + """ + print("the installation of i3 does not conatain any configuerations for the wm. in this shell you take your time should add your configuerations") + subprocess.check_call("arch-chroot /mnt",shell=True) + if __name__ == 'i3-wm': # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 168abb72..8b541bbf 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -1,4 +1,4 @@ -import archinstall +import archinstall, subprocess def _prep_function(*args, **kwargs): """ @@ -15,6 +15,13 @@ def _prep_function(*args, **kwargs): return imported._prep_function() else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + """ + Another magic function called after the system + has been installed. + """ + print("the installation of i3-gaps does not conatain any configuerations for the wm. in this shell you should take your time to add your configuerations") + subprocess.check_call("arch-chroot /mnt",shell=True) if __name__ == 'i3-wm': # Install dependency profiles -- cgit v1.2.3-70-g09d2 From 2f153d4882bc7954288d608721858554627ce2d7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 09:53:28 +0200 Subject: Some language correction and function handling I more or less copied the language from i3-wm as it was more correct. Also converted `print()` into `installation.log()` so that we can get some color control and end up in the debug log. Finally, I added a try/except to handle potential crashes and return return values, since otherwise this would happen every run: * https://github.com/archlinux/archinstall/pull/190/files#diff-98d75a109b5337cd7d7c948d2cfc2379bcc51be22dfa3ca6491765f0e0bcaaabR349-R355 --- profiles/i3-gaps.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index d9469dcd..96d972e3 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -21,8 +21,13 @@ def _post_install(*args, **kwargs): Another magic function called after the system has been installed. """ - print("the installation of i3 does not conatain any configuerations for the wm. in this shell you take your time should add your configuerations") - subprocess.check_call("arch-chroot /mnt",shell=True) + installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") + try: + subprocess.check_call("arch-chroot /mnt",shell=True) + except subprocess.CallProcessError: + return False + + return True if __name__ == 'i3-wm': # Install dependency profiles -- cgit v1.2.3-70-g09d2 From 0df567286e78ae8b5705ce22b7bc76aa28ee11f6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 09:54:24 +0200 Subject: Swapped print for log and added return values --- profiles/i3-wm.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 8b541bbf..66a7884e 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -20,8 +20,13 @@ def _post_install(*args, **kwargs): Another magic function called after the system has been installed. """ - print("the installation of i3-gaps does not conatain any configuerations for the wm. in this shell you should take your time to add your configuerations") - subprocess.check_call("arch-chroot /mnt",shell=True) + installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") + try: + subprocess.check_call("arch-chroot /mnt",shell=True) + except subprocess.CallProcessError: + return False + + return True if __name__ == 'i3-wm': # Install dependency profiles @@ -32,4 +37,4 @@ if __name__ == 'i3-wm': i3 = archinstall.Application(installation, 'i3-wm') i3.install() # Auto start lightdm for all users - installation.enable_service('lightdm') \ No newline at end of file + installation.enable_service('lightdm') -- cgit v1.2.3-70-g09d2 From 4f7fc94ecd2c7a63e5f8ed9b30943314680b0c51 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 08:34:34 +0530 Subject: merge kde and kde-wayland --- profiles/applications/kde-wayland.py | 7 ------- profiles/kde-wayland.py | 34 ---------------------------------- profiles/kde.py | 13 ++++++++++++- 3 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 profiles/applications/kde-wayland.py delete mode 100644 profiles/kde-wayland.py (limited to 'profiles') diff --git a/profiles/applications/kde-wayland.py b/profiles/applications/kde-wayland.py deleted file mode 100644 index 6a9be294..00000000 --- a/profiles/applications/kde-wayland.py +++ /dev/null @@ -1,7 +0,0 @@ -import archinstall -packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" -# if the package selection can be reduced go for it -if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" -installation.add_additional_packages(packages) -# We'll support plasma-desktop-wayland (minimal) later diff --git a/profiles/kde-wayland.py b/profiles/kde-wayland.py deleted file mode 100644 index 31226952..00000000 --- a/profiles/kde-wayland.py +++ /dev/null @@ -1,34 +0,0 @@ -# A desktop environement using "KDE". -import archinstall, os - -# TODO: Remove hard dependency of bash (due to .bash_profile) - -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. - """ - - # KDE 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("kde", "/somewhere/kde.py") -# or through conventional import kde -if __name__ == 'kde-wayland': - # Install dependency profiles - installation.install_profile('xorg') - - # Install the application kde from the template under /applications/ - kde = archinstall.Application(installation, 'kde-wayland') - kde.install() - print("when you login, select Plasma (Wayland) for the wayland session") - # Enable autostart of KDE for all users - installation.enable_service('sddm') diff --git a/profiles/kde.py b/profiles/kde.py index 752a08d2..89bc5080 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environement using "KDE". -import archinstall, os +import archinstall, os # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -20,6 +20,17 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + if "nvidia" in _gfx_driver_packages: + print("Plasma wayland is currently in a buggy state on Nvidia cards") + choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() + if choice == "y": + packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" + # if the package selection can be reduced go for it + if "nvidia" in _gfx_driver_packages: + packages = packages + " egl-wayland" + installation.add_additional_packages(packages) + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From aea819af15e2c3a6312a9363b68e0df78abd585b Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 17:36:20 +0530 Subject: Update kde.py --- profiles/kde.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/kde.py b/profiles/kde.py index 89bc5080..07796832 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -25,7 +25,7 @@ def _post_install(*args, **kwargs): print("Plasma wayland is currently in a buggy state on Nvidia cards") choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() if choice == "y": - packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" + packages = "plasma-wayland-session" # if the package selection can be reduced go for it if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" -- cgit v1.2.3-70-g09d2 From 5057035f3ed9ad14630c99f90a9bd6ffe095704e Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 18:28:18 +0530 Subject: ask user for default session over asking if they want wayland --- profiles/applications/kde.py | 2 +- profiles/kde.py | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index 87a266b0..c0972d50 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,2 +1,2 @@ import archinstall -installation.add_additional_packages("plasma-meta kde-applications-meta sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta +installation.add_additional_packages("plasma-meta kde-applications-meta plasma-wayland-session sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta diff --git a/profiles/kde.py b/profiles/kde.py index 07796832..09cdab13 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environement using "KDE". -import archinstall, os +import archinstall, os, shutil # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -22,15 +22,11 @@ def _prep_function(*args, **kwargs): def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: - print("Plasma wayland is currently in a buggy state on Nvidia cards") - choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() + print("Plasma wayland is currently in an unusable state on Nvidia cards") + choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() if choice == "y": - packages = "plasma-wayland-session" - # if the package selection can be reduced go for it - if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" - installation.add_additional_packages(packages) - + shutil.move("/usr/share/xsessions/plasma.desktop","/usr/share/xsessions/plasmax11.desktop") + shutil.move("/usr/share/wayland-sessions/plasmawayland.desktop","/usr/share/wayland-sessions/plasma.desktop") # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From 29d939cfcab3a55cd2531ccdeb493e9c4d898560 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 18:59:05 +0530 Subject: added egl-wayland and changed prompt --- profiles/applications/kde.py | 5 ++++- profiles/kde.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index c0972d50..fc42223b 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,2 +1,5 @@ import archinstall -installation.add_additional_packages("plasma-meta kde-applications-meta plasma-wayland-session sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta +packages = "plasma-meta kde-applications-meta sddm plasma-wayland-session" +if "nvidia" in _gfx_driver_packages: + packages = packages + " egl-wayland" +installation.add_additional_packages(packages) \ No newline at end of file diff --git a/profiles/kde.py b/profiles/kde.py index 09cdab13..04dcaaa4 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environement using "KDE". -import archinstall, os, shutil +import archinstall, os # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -22,11 +22,11 @@ def _prep_function(*args, **kwargs): def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: - print("Plasma wayland is currently in an unusable state on Nvidia cards") + print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() if choice == "y": - shutil.move("/usr/share/xsessions/plasma.desktop","/usr/share/xsessions/plasmax11.desktop") - shutil.move("/usr/share/wayland-sessions/plasmawayland.desktop","/usr/share/wayland-sessions/plasma.desktop") + installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") + installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From b968bec77182b215c8786ac22b794c8440f46df9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 18:27:30 +0200 Subject: Added a forgotten return value of _post_install --- profiles/kde.py | 1 + 1 file changed, 1 insertion(+) (limited to 'profiles') diff --git a/profiles/kde.py b/profiles/kde.py index 04dcaaa4..0207ed22 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -27,6 +27,7 @@ def _post_install(*args, **kwargs): if choice == "y": installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") + return True # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From ee6cd39fe6c0ac0cd2f63be4547db11334ce9fb9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 12:33:13 -0400 Subject: Switch from metapackage to a more minimal install --- profiles/applications/kde.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index fc42223b..77343d9a 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,5 +1,5 @@ import archinstall -packages = "plasma-meta kde-applications-meta sddm plasma-wayland-session" +packages = "plasma-meta konsole kate dolphin khelpcenter sddm plasma-wayland-session" if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" -installation.add_additional_packages(packages) \ No newline at end of file +installation.add_additional_packages(packages) -- cgit v1.2.3-70-g09d2 From 87514ab5155306ab98a257ebb436ef3f127a91b0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:27:00 -0400 Subject: Noticed that some KDE instances weren't changed to i3 when copying Another one --- profiles/i3-gaps.py | 2 +- profiles/i3-wm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index 96d972e3..50511dce 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -8,7 +8,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # KDE requires a functioning Xorg installation. + # i3 requires a functioning Xorg installation. profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 66a7884e..cd6cbc81 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -8,7 +8,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # KDE requires a functioning Xorg installation. + # i3 requires a functioning Xorg installation. profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): -- cgit v1.2.3-70-g09d2 From 0a1e0641a90a404f9942f4006ad1e5650c8a1724 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:45:08 -0400 Subject: It was pointed out that khelpcenter isn't strictly necessary --- profiles/applications/kde.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index 77343d9a..af1e6597 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,5 +1,5 @@ import archinstall -packages = "plasma-meta konsole kate dolphin khelpcenter sddm plasma-wayland-session" +packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" installation.add_additional_packages(packages) -- cgit v1.2.3-70-g09d2 From c6eb3dfbdfde53eec4d6f15b05af3416650e4339 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:53:20 -0400 Subject: Fix incorrect comment. Cinnamon doesn't have any Wayland support yet. --- profiles/cinnamon.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index e9c5d085..dac38bd3 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -10,8 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # Cinnamon optionally supports xorg, we'll install it since it also - # includes graphic driver setups (this might change in the future) + # Cinnamon requires a functioning Xorg installation. profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): -- cgit v1.2.3-70-g09d2 From 0a5a929f5b01c8ff4b07bd3bf2a60ed5e284dd30 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:55:04 -0400 Subject: Fix another incorrect comment on XFCE4 profile --- profiles/xfce4.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 1cc4a62d..36c9958a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -11,8 +11,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # Gnome optionally supports xorg, we'll install it since it also - # includes graphic driver setups (this might change in the future) + # XFCE requires a functional xorg installation. profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): -- cgit v1.2.3-70-g09d2 From ac7d980f8920b90e213acf95ca87b459eb072f3a Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 08:37:39 -0400 Subject: Add minimal profile and implement idea of 'top-level' profiles --- profiles/awesome.py | 2 ++ profiles/cinnamon.py | 2 ++ profiles/desktop.py | 2 ++ profiles/gnome.py | 2 ++ profiles/i3-gaps.py | 2 ++ profiles/i3-wm.py | 2 ++ profiles/kde.py | 2 ++ profiles/minimal.py | 23 +++++++++++++++++++++++ profiles/xfce4.py | 2 ++ profiles/xorg.py | 2 ++ 10 files changed, 41 insertions(+) create mode 100644 profiles/minimal.py (limited to 'profiles') diff --git a/profiles/awesome.py b/profiles/awesome.py index 6b1167bf..0d133962 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -2,6 +2,8 @@ import archinstall +is_top_level_profile = False + # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". __packages__ = ['nano', 'nemo', 'gpicview-gtk3', 'openssh', 'sshfs', 'htop', 'scrot', 'wget'] diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 528158d8..1a796bc7 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -1,6 +1,8 @@ # A desktop environment using "Cinnamon" import archinstall +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/desktop.py b/profiles/desktop.py index b8270881..9f9e7cc2 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = True + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/gnome.py b/profiles/gnome.py index b37679de..c75cafee 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -2,6 +2,8 @@ import archinstall +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index 50511dce..e900117a 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -1,5 +1,7 @@ import archinstall, subprocess +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index cd6cbc81..a2449e39 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -1,5 +1,7 @@ import archinstall, subprocess +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/kde.py b/profiles/kde.py index e1449d81..10ef3766 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = False + # TODO: Remove hard dependency of bash (due to .bash_profile) def _prep_function(*args, **kwargs): diff --git a/profiles/minimal.py b/profiles/minimal.py new file mode 100644 index 00000000..0e27bdab --- /dev/null +++ b/profiles/minimal.py @@ -0,0 +1,23 @@ +# Used to do a minimal install + +import archinstall, os + +is_top_level_profile = True + +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. + """ + + # Do nothing here for now + +if __name__ == 'minimal': + """ + This "profile" is a meta-profile. + It is used for a custom minimal installation, without any desktop-specific packages. + """ + + # Do nothing here for now diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 36c9958a..c8637eda 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -1,6 +1,8 @@ # A desktop environment using "Xfce4" +is_top_level_profile = False + import archinstall def _prep_function(*args, **kwargs): diff --git a/profiles/xorg.py b/profiles/xorg.py index 1282b8a5..e905d533 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = True + AVAILABLE_DRIVERS = { # Sub-dicts are layer-2 options to be selected # and lists are a list of packages to be installed -- cgit v1.2.3-70-g09d2 From 9756d9ed2daea533930e24a799ff9bf55891c203 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 09:23:21 -0400 Subject: Add i3 selections to desktop file --- archinstall/lib/profiles.py | 3 +-- profiles/desktop.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 1948a819..5f69c8c6 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -196,9 +196,8 @@ class Profile(Script): def is_top_level_profile(self): with open(self.path, 'r') as source: - source_data = source.read() - # TODO: I imagine that there is probably a better way to write this. + source_data = source.read() return 'top_level_profile = True' in source_data @property diff --git a/profiles/desktop.py b/profiles/desktop.py index 9f9e7cc2..389198d6 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon'] + supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-70-g09d2 From 99917807bd926185a8feb38185f0e4b09b3e0738 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 11:33:01 -0400 Subject: Fix issue with prep function --- profiles/minimal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'profiles') diff --git a/profiles/minimal.py b/profiles/minimal.py index 0e27bdab..26a3c75c 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -11,13 +11,11 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - - # Do nothing here for now + return True # Do nothing here for now if __name__ == 'minimal': """ This "profile" is a meta-profile. It is used for a custom minimal installation, without any desktop-specific packages. """ - # Do nothing here for now -- cgit v1.2.3-70-g09d2 From bf91c66ba89121ab062a5c40fdb2249a5522ec8a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 7 Apr 2021 11:54:10 -0400 Subject: Clean up comments a bit --- profiles/minimal.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'profiles') diff --git a/profiles/minimal.py b/profiles/minimal.py index 26a3c75c..79821a89 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -7,15 +7,14 @@ is_top_level_profile = True 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. + before continuing any further. For minimal install, + we don't need to do anything special here, but it + needs to exist and return True. """ - return True # Do nothing here for now + return True # Do nothing and just return True if __name__ == 'minimal': """ This "profile" is a meta-profile. It is used for a custom minimal installation, without any desktop-specific packages. """ - # Do nothing here for now -- cgit v1.2.3-70-g09d2 From 78d58eb4b7403449e9f854dea43c46d1fc3b1179 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 8 Apr 2021 07:23:37 +0530 Subject: removed post_install hook --- profiles/kde.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/kde.py b/profiles/kde.py index 0207ed22..2c4cefb9 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -20,7 +20,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -def _post_install(*args, **kwargs): +""" def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() @@ -28,6 +28,8 @@ def _post_install(*args, **kwargs): installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") return True +As Dylan pointed out this could break things in a update lets just stick to defaults for now +""" # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From 57de67e5fbd06ef6e81bf804352ff57a06c69475 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 8 Apr 2021 08:26:57 +0530 Subject: Update kde.py --- profiles/kde.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'profiles') diff --git a/profiles/kde.py b/profiles/kde.py index 2c4cefb9..59276c4f 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -20,16 +20,12 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -""" def _post_install(*args, **kwargs): +def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") - choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() - if choice == "y": - installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") - installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") + print("After booting, you can choose between Wayland and Xorg using the drop-down menu") return True -As Dylan pointed out this could break things in a update lets just stick to defaults for now -""" + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From 9d6541aaa6506bcbfbceb3148d20947696cde580 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 8 Apr 2021 14:06:27 +0530 Subject: sway, wayland specific files. drivers has also been split from xorg --- archinstall/lib/drivers.py | 65 ++++++++++++++++++++++++++++++++++++++++++ profiles/applications/sway.py | 3 ++ profiles/sway.py | 39 +++++++++++++++++++++++++ profiles/wayland.py | 43 ++++++++++++++++++++++++++++ profiles/xorg.py | 66 +------------------------------------------ 5 files changed, 151 insertions(+), 65 deletions(-) create mode 100644 archinstall/lib/drivers.py create mode 100644 profiles/applications/sway.py create mode 100644 profiles/sway.py create mode 100644 profiles/wayland.py (limited to 'profiles') diff --git a/archinstall/lib/drivers.py b/archinstall/lib/drivers.py new file mode 100644 index 00000000..7abb9db0 --- /dev/null +++ b/archinstall/lib/drivers.py @@ -0,0 +1,65 @@ +import archinstall +def select_driver(options): + """ + Some what convoluted function, which's job is simple. + Select a graphics driver from a pre-defined set of popular options. + + (The template xorg is for beginner users, not advanced, and should + there for appeal to the general public first and edge cases later) + """ + drivers = sorted(list(options)) + + if len(drivers) >= 1: + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') + print(' -- You need to select (and read about) which one you need. --') + + lspci = archinstall.sys_command(f'/usr/bin/lspci') + for line in lspci.trace_log.split(b'\r\n'): + 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 **') + + selected_driver = input('Select your graphics card driver: ') + initial_option = selected_driver + + # Disabled search for now, only a few profiles exist anyway + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: + selected_driver = options[drivers[pos]] + elif selected_driver in options: + selected_driver = options[options.index(selected_driver)] + elif len(selected_driver) == 0: + raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") + else: + raise archinstall.RequirementError("Selected driver does not exist.") + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + for index, driver_package_group in enumerate(driver_options): + print(f"{index}: {driver_package_group}") + + selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') + if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: + selected_driver_package_group = selected_driver[driver_options[pos]] + elif selected_driver_package_group in selected_driver: + selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] + elif len(selected_driver_package_group) == 0: + raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") + else: + raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.") + + return selected_driver_package_group + + return selected_driver + + raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py new file mode 100644 index 00000000..7434c62a --- /dev/null +++ b/profiles/applications/sway.py @@ -0,0 +1,3 @@ +import archinstall +packages = "sway swaylock swayidle dmenu alacritty" +installation.add_additional_packages(packages) \ No newline at end of file diff --git a/profiles/sway.py b/profiles/sway.py new file mode 100644 index 00000000..cf1784e9 --- /dev/null +++ b/profiles/sway.py @@ -0,0 +1,39 @@ +import archinstall, os, subprocess + +# TODO: Remove hard dependency of bash (due to .bash_profile) + +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. + """ + + # KDE requires a functioning Xorg installation. + profile = archinstall.Profile(None, 'wayland') + with profile.load_instructions(namespace='wayland.py') as imported: + if hasattr(imported, '_prep_function'): + return imported._prep_function() + else: + print('Deprecated (??): xorg profile has no _prep_function() anymore') + +def _post_install(*args, **kwargs): + installation.log("We do not ship a default configueration for sway. before you restart you should add one\nsway also does not support a displaymanger offcialy. to start it login and run the command sway") + try: + subprocess.check_call("arch-chroot /mnt",shell=True) + except subprocess.CallProcessError: + return False +# Ensures that this code only gets executed if executed +# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") +# or through conventional import kde +if __name__ == 'sway': + # Install dependency profiles + if "nvidia" in _gfx_driver_packages: + raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not support nvidia cards") + else: + installation.install_profile('wayland') + + # Install the application kde from the template under /applications/ + sway = archinstall.Application(installation, 'sway') + sway.install() diff --git a/profiles/wayland.py b/profiles/wayland.py new file mode 100644 index 00000000..3107055c --- /dev/null +++ b/profiles/wayland.py @@ -0,0 +1,43 @@ +import archinstall, os + +AVAILABLE_DRIVERS = { + # Sub-dicts are layer-2 options to be selected + # and lists are a list of packages to be installed + 'AMD / ATI' : { + 'amd' : ['xf86-video-amdgpu'], + 'ati' : ['xf86-video-ati'] + }, + 'intel' : ['xf86-video-intel'], + 'nvidia' : { + 'open source' : ['xf86-video-nouveau'], + 'proprietary' : ['nvidia'] + }, + 'mesa' : ['mesa'], + 'fbdev' : ['xf86-video-fbdev'], + 'vesa' : ['xf86-video-vesa'], + 'vmware' : ['xf86-video-vmware'] +} + + +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. + """ + print('You need to select which graphics card you\'re using.') + print('This in order to setup the required graphics drivers.') + + __builtins__['_gfx_driver_packages'] = archinstall.lib.drivers.select_driver(AVAILABLE_DRIVERS) + + # TODO: Add language section and/or merge it with the locale selected + # earlier in for instance guided.py installer. + + return True + +if __name__ == "__wayland__": + try: + installation.add_additional_packages(f"wayland {' '.join(_gfx_driver_packages)}") + except: + installation.add_additional_packages(f"wayland") # Prep didn't run, so there's no driver to install \ No newline at end of file diff --git a/profiles/xorg.py b/profiles/xorg.py index 1282b8a5..79418d1d 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -20,70 +20,6 @@ AVAILABLE_DRIVERS = { 'vmware' : ['xf86-video-vmware'] } -def select_driver(options): - """ - Some what convoluted function, which's job is simple. - Select a graphics driver from a pre-defined set of popular options. - - (The template xorg is for beginner users, not advanced, and should - there for appeal to the general public first and edge cases later) - """ - drivers = sorted(list(options)) - - if len(drivers) >= 1: - for index, driver in enumerate(drivers): - print(f"{index}: {driver}") - - print(' -- The above list are supported graphic card drivers. --') - print(' -- You need to select (and read about) which one you need. --') - - lspci = archinstall.sys_command(f'/usr/bin/lspci') - for line in lspci.trace_log.split(b'\r\n'): - 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 **') - - selected_driver = input('Select your graphics card driver: ') - initial_option = selected_driver - - # Disabled search for now, only a few profiles exist anyway - # - #print(' -- You can enter ? or help to search for more drivers --') - #if selected_driver.lower() in ('?', 'help'): - # filter_string = input('Search for layout containing (example: "sv-"): ') - # new_options = search_keyboard_layout(filter_string) - # return select_language(new_options) - if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: - selected_driver = options[drivers[pos]] - elif selected_driver in options: - selected_driver = options[options.index(selected_driver)] - elif len(selected_driver) == 0: - raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") - else: - raise archinstall.RequirementError("Selected driver does not exist.") - - if type(selected_driver) == dict: - driver_options = sorted(list(selected_driver)) - for index, driver_package_group in enumerate(driver_options): - print(f"{index}: {driver_package_group}") - - selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') - if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: - selected_driver_package_group = selected_driver[driver_options[pos]] - elif selected_driver_package_group in selected_driver: - selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] - elif len(selected_driver_package_group) == 0: - raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") - else: - raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.") - - return selected_driver_package_group - - return selected_driver - - raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.") def _prep_function(*args, **kwargs): """ @@ -95,7 +31,7 @@ def _prep_function(*args, **kwargs): print('You need to select which graphics card you\'re using.') print('This in order to setup the required graphics drivers.') - __builtins__['_gfx_driver_packages'] = select_driver(AVAILABLE_DRIVERS) + __builtins__['_gfx_driver_packages'] = archinstall.lib.drivers.select_driver(AVAILABLE_DRIVERS) # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. -- cgit v1.2.3-70-g09d2 From 1a760c591f773a477da2c18041634610b070cf5a Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 9 Apr 2021 12:05:51 +0530 Subject: Update sway.py --- profiles/sway.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'profiles') diff --git a/profiles/sway.py b/profiles/sway.py index cf1784e9..15bc9321 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -1,4 +1,4 @@ -import archinstall, os, subprocess +import archinstall, os # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -19,11 +19,7 @@ def _prep_function(*args, **kwargs): print('Deprecated (??): xorg profile has no _prep_function() anymore') def _post_install(*args, **kwargs): - installation.log("We do not ship a default configueration for sway. before you restart you should add one\nsway also does not support a displaymanger offcialy. to start it login and run the command sway") - try: - subprocess.check_call("arch-chroot /mnt",shell=True) - except subprocess.CallProcessError: - return False + installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and do it there") # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From 8a39bdde4b331a10376ae238b2b3df3a351ba06c Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 9 Apr 2021 12:13:41 +0530 Subject: added information on how to start sway --- profiles/sway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/sway.py b/profiles/sway.py index 15bc9321..8dd12c42 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -19,7 +19,7 @@ def _prep_function(*args, **kwargs): print('Deprecated (??): xorg profile has no _prep_function() anymore') def _post_install(*args, **kwargs): - installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and do it there") + installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and do it there\nto start sway run the command sway") # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From 349c3ec5b4e84a1c0df72eb2167fb04a3722b208 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 9 Apr 2021 13:16:39 +0530 Subject: Update sway.py --- profiles/sway.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/sway.py b/profiles/sway.py index 8dd12c42..7a0b9beb 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -19,7 +19,19 @@ def _prep_function(*args, **kwargs): print('Deprecated (??): xorg profile has no _prep_function() anymore') def _post_install(*args, **kwargs): - installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and do it there\nto start sway run the command sway") + choice = input("Would you like to autostart sway on login [Y/n]: ") + if choice.lower == "y": + with open(f"{installation.mountpoint}/etc/profile", "a") as f: + x = """ + if [ -z $DISPLAY ] && [ "$(tty)" == "/dev/tty1" ]; then + exec sway + fi + """ + f.write(x) + f.close() + else: + installation.log("to start sway run the command sway") + installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and modify it") # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde -- cgit v1.2.3-70-g09d2 From b85514ae5e4cdedf00795f165fbcd17abd2cb4fd Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 9 Apr 2021 13:28:12 +0530 Subject: renamed driver.py to gfx_driver.py. also explictly check if we are using the propritery nvidia drivers --- archinstall/lib/drivers.py | 65 ------------------------------------------ archinstall/lib/gfx_drivers.py | 65 ++++++++++++++++++++++++++++++++++++++++++ profiles/sway.py | 6 ++-- profiles/wayland.py | 2 +- profiles/xorg.py | 2 +- 5 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 archinstall/lib/drivers.py create mode 100644 archinstall/lib/gfx_drivers.py (limited to 'profiles') diff --git a/archinstall/lib/drivers.py b/archinstall/lib/drivers.py deleted file mode 100644 index 7abb9db0..00000000 --- a/archinstall/lib/drivers.py +++ /dev/null @@ -1,65 +0,0 @@ -import archinstall -def select_driver(options): - """ - Some what convoluted function, which's job is simple. - Select a graphics driver from a pre-defined set of popular options. - - (The template xorg is for beginner users, not advanced, and should - there for appeal to the general public first and edge cases later) - """ - drivers = sorted(list(options)) - - if len(drivers) >= 1: - for index, driver in enumerate(drivers): - print(f"{index}: {driver}") - - print(' -- The above list are supported graphic card drivers. --') - print(' -- You need to select (and read about) which one you need. --') - - lspci = archinstall.sys_command(f'/usr/bin/lspci') - for line in lspci.trace_log.split(b'\r\n'): - 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 **') - - selected_driver = input('Select your graphics card driver: ') - initial_option = selected_driver - - # Disabled search for now, only a few profiles exist anyway - # - #print(' -- You can enter ? or help to search for more drivers --') - #if selected_driver.lower() in ('?', 'help'): - # filter_string = input('Search for layout containing (example: "sv-"): ') - # new_options = search_keyboard_layout(filter_string) - # return select_language(new_options) - if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: - selected_driver = options[drivers[pos]] - elif selected_driver in options: - selected_driver = options[options.index(selected_driver)] - elif len(selected_driver) == 0: - raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") - else: - raise archinstall.RequirementError("Selected driver does not exist.") - - if type(selected_driver) == dict: - driver_options = sorted(list(selected_driver)) - for index, driver_package_group in enumerate(driver_options): - print(f"{index}: {driver_package_group}") - - selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') - if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: - selected_driver_package_group = selected_driver[driver_options[pos]] - elif selected_driver_package_group in selected_driver: - selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] - elif len(selected_driver_package_group) == 0: - raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") - else: - raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.") - - return selected_driver_package_group - - return selected_driver - - raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file diff --git a/archinstall/lib/gfx_drivers.py b/archinstall/lib/gfx_drivers.py new file mode 100644 index 00000000..7abb9db0 --- /dev/null +++ b/archinstall/lib/gfx_drivers.py @@ -0,0 +1,65 @@ +import archinstall +def select_driver(options): + """ + Some what convoluted function, which's job is simple. + Select a graphics driver from a pre-defined set of popular options. + + (The template xorg is for beginner users, not advanced, and should + there for appeal to the general public first and edge cases later) + """ + drivers = sorted(list(options)) + + if len(drivers) >= 1: + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') + print(' -- You need to select (and read about) which one you need. --') + + lspci = archinstall.sys_command(f'/usr/bin/lspci') + for line in lspci.trace_log.split(b'\r\n'): + 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 **') + + selected_driver = input('Select your graphics card driver: ') + initial_option = selected_driver + + # Disabled search for now, only a few profiles exist anyway + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: + selected_driver = options[drivers[pos]] + elif selected_driver in options: + selected_driver = options[options.index(selected_driver)] + elif len(selected_driver) == 0: + raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") + else: + raise archinstall.RequirementError("Selected driver does not exist.") + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + for index, driver_package_group in enumerate(driver_options): + print(f"{index}: {driver_package_group}") + + selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') + if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: + selected_driver_package_group = selected_driver[driver_options[pos]] + elif selected_driver_package_group in selected_driver: + selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] + elif len(selected_driver_package_group) == 0: + raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") + else: + raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.") + + return selected_driver_package_group + + return selected_driver + + raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file diff --git a/profiles/sway.py b/profiles/sway.py index 7a0b9beb..edc3b744 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): if hasattr(imported, '_prep_function'): return imported._prep_function() else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') + print('Deprecated (??): wayland profile has no _prep_function() anymore') def _post_install(*args, **kwargs): choice = input("Would you like to autostart sway on login [Y/n]: ") @@ -37,8 +37,8 @@ def _post_install(*args, **kwargs): # or through conventional import kde if __name__ == 'sway': # Install dependency profiles - if "nvidia" in _gfx_driver_packages: - raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not support nvidia cards") + if _gfx_driver_packages == 'nvidia': + raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not the prorpitery nvidia driver try using nouveau") else: installation.install_profile('wayland') diff --git a/profiles/wayland.py b/profiles/wayland.py index 3107055c..8edae3c2 100644 --- a/profiles/wayland.py +++ b/profiles/wayland.py @@ -29,7 +29,7 @@ def _prep_function(*args, **kwargs): print('You need to select which graphics card you\'re using.') print('This in order to setup the required graphics drivers.') - __builtins__['_gfx_driver_packages'] = archinstall.lib.drivers.select_driver(AVAILABLE_DRIVERS) + __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS) # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. diff --git a/profiles/xorg.py b/profiles/xorg.py index 79418d1d..542558c6 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -31,7 +31,7 @@ def _prep_function(*args, **kwargs): print('You need to select which graphics card you\'re using.') print('This in order to setup the required graphics drivers.') - __builtins__['_gfx_driver_packages'] = archinstall.lib.drivers.select_driver(AVAILABLE_DRIVERS) + __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS) # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. -- cgit v1.2.3-70-g09d2 From d510ad5b989dabc2a4cb7b622a000ff2146f325b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 10 Apr 2021 11:37:04 -0400 Subject: Delete wayland.py --- profiles/wayland.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 profiles/wayland.py (limited to 'profiles') diff --git a/profiles/wayland.py b/profiles/wayland.py deleted file mode 100644 index 8edae3c2..00000000 --- a/profiles/wayland.py +++ /dev/null @@ -1,43 +0,0 @@ -import archinstall, os - -AVAILABLE_DRIVERS = { - # Sub-dicts are layer-2 options to be selected - # and lists are a list of packages to be installed - 'AMD / ATI' : { - 'amd' : ['xf86-video-amdgpu'], - 'ati' : ['xf86-video-ati'] - }, - 'intel' : ['xf86-video-intel'], - 'nvidia' : { - 'open source' : ['xf86-video-nouveau'], - 'proprietary' : ['nvidia'] - }, - 'mesa' : ['mesa'], - 'fbdev' : ['xf86-video-fbdev'], - 'vesa' : ['xf86-video-vesa'], - 'vmware' : ['xf86-video-vmware'] -} - - -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. - """ - print('You need to select which graphics card you\'re using.') - print('This in order to setup the required graphics drivers.') - - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS) - - # TODO: Add language section and/or merge it with the locale selected - # earlier in for instance guided.py installer. - - return True - -if __name__ == "__wayland__": - try: - installation.add_additional_packages(f"wayland {' '.join(_gfx_driver_packages)}") - except: - installation.add_additional_packages(f"wayland") # Prep didn't run, so there's no driver to install \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 5f46f76bd594cf55af4a2a3344599d61d89b2f65 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 11:58:53 -0400 Subject: Multiple restructuring changes --- archinstall/lib/gfx_drivers.py | 21 ++++++++++++++++++++- profiles/desktop.py | 2 ++ profiles/sway.py | 28 +++++++++++++--------------- profiles/xorg.py | 23 +---------------------- 4 files changed, 36 insertions(+), 38 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/gfx_drivers.py b/archinstall/lib/gfx_drivers.py index 7abb9db0..e1fb2824 100644 --- a/archinstall/lib/gfx_drivers.py +++ b/archinstall/lib/gfx_drivers.py @@ -1,5 +1,24 @@ import archinstall -def select_driver(options): + +AVAILABLE_DRIVERS = { + # Sub-dicts are layer-2 options to be selected + # and lists are a list of packages to be installed + 'AMD / ATI' : { + 'amd' : ['xf86-video-amdgpu'], + 'ati' : ['xf86-video-ati'] + }, + 'intel' : ['xf86-video-intel'], + 'nvidia' : { + 'open source' : ['xf86-video-nouveau'], + 'proprietary' : ['nvidia'] + }, + 'mesa' : ['mesa'], + 'fbdev' : ['xf86-video-fbdev'], + 'vesa' : ['xf86-video-vesa'], + 'vmware' : ['xf86-video-vmware'] +} + +def select_driver(options=AVAILABLE_DRIVERS): """ Some what convoluted function, which's job is simple. Select a graphics driver from a pre-defined set of popular options. diff --git a/profiles/desktop.py b/profiles/desktop.py index 389198d6..8da6269b 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -12,6 +12,8 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ + __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') diff --git a/profiles/sway.py b/profiles/sway.py index edc3b744..10e30753 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -10,13 +10,9 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # KDE requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'wayland') - with profile.load_instructions(namespace='wayland.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): wayland profile has no _prep_function() anymore') + __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + + return True def _post_install(*args, **kwargs): choice = input("Would you like to autostart sway on login [Y/n]: ") @@ -30,18 +26,20 @@ def _post_install(*args, **kwargs): f.write(x) f.close() else: - installation.log("to start sway run the command sway") - installation.log("we use the default configartion shipped by arch linux, if you wish to change it you should chroot into the installation and modify it") + installation.log("To start Sway, run the 'sway' command after logging in.") + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde if __name__ == 'sway': + + installation.add_additional_packages(_gfx_driver_packages) + # Install dependency profiles if _gfx_driver_packages == 'nvidia': - raise archinstall.lib.exceptions.HardwareIncompatibilityError("sway does not the prorpitery nvidia driver try using nouveau") - else: - installation.install_profile('wayland') + # NOTE: This is technically runnable with the --my-next-gpu-wont-be-nvidia option + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not officially support the proprietary Nvidia driver, you may have to use nouveau.") - # Install the application kde from the template under /applications/ - sway = archinstall.Application(installation, 'sway') - sway.install() + # Install the application kde from the template under /applications/ + sway = archinstall.Application(installation, 'sway') + sway.install() diff --git a/profiles/xorg.py b/profiles/xorg.py index 33356859..6ee72487 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -4,25 +4,6 @@ import archinstall, os is_top_level_profile = True -AVAILABLE_DRIVERS = { - # Sub-dicts are layer-2 options to be selected - # and lists are a list of packages to be installed - 'AMD / ATI' : { - 'amd' : ['xf86-video-amdgpu'], - 'ati' : ['xf86-video-ati'] - }, - 'intel' : ['xf86-video-intel'], - 'nvidia' : { - 'open source' : ['xf86-video-nouveau'], - 'proprietary' : ['nvidia'] - }, - 'mesa' : ['mesa'], - 'fbdev' : ['xf86-video-fbdev'], - 'vesa' : ['xf86-video-vesa'], - 'vmware' : ['xf86-video-vmware'] -} - - def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -30,10 +11,8 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - print('You need to select which graphics card you\'re using.') - print('This in order to setup the required graphics drivers.') - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver(AVAILABLE_DRIVERS) + __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. -- cgit v1.2.3-70-g09d2 From f74dab9a5aef283b2e35515dab0e7a51786e559f Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 12:14:17 -0400 Subject: Don't want prompt twice --- profiles/desktop.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'profiles') diff --git a/profiles/desktop.py b/profiles/desktop.py index 8da6269b..389198d6 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -12,8 +12,6 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() - supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') -- cgit v1.2.3-70-g09d2 From 09f252d0315469ad699066279e04c4e3424ea967 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 13:29:20 -0400 Subject: Make desktop.py line match master. --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/desktop.py b/profiles/desktop.py index 389198d6..22a407b6 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'xfce4', 'cinnamon', 'i3-gaps', 'i3-wm'] + 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 -- cgit v1.2.3-70-g09d2 From 1292c07796b763b926fd5edb21905a663eaef8f0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 11 Apr 2021 10:20:33 +0200 Subject: Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. --- archinstall/lib/hardware.py | 19 +++++++++++ archinstall/lib/installer.py | 1 - archinstall/lib/user_interaction.py | 67 +++++++++++++++++++++++++++++++++++++ profiles/sway.py | 2 +- profiles/xorg.py | 2 +- 5 files changed, 88 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 3da333de..047b3491 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -2,6 +2,25 @@ import os, subprocess, json from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes from typing import Optional + +AVAILABLE_GFX_DRIVERS = { + # Sub-dicts are layer-2 options to be selected + # and lists are a list of packages to be installed + 'AMD / ATI' : { + 'amd' : ['xf86-video-amdgpu'], + 'ati' : ['xf86-video-ati'] + }, + 'intel' : ['xf86-video-intel'], + 'nvidia' : { + 'open source' : ['xf86-video-nouveau'], + 'proprietary' : ['nvidia'] + }, + 'mesa' : ['mesa'], + 'fbdev' : ['xf86-video-fbdev'], + 'vesa' : ['xf86-video-vesa'], + 'vmware' : ['xf86-video-vmware'] +} + def hasWifi()->bool: return 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values() diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 5523b1e1..484e7407 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -10,7 +10,6 @@ from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage from .hardware import * -from .gfx_drivers import * # Any package that the Installer() is responsible for (optional and the default ones) __packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b94bf3f5..d17691de 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -5,6 +5,8 @@ from .locale_helpers import search_keyboard_layout from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces +from .general import sys_command +from .hardware import AVAILABLE_GFX_DRIVERS ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -363,3 +365,68 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): return selected_mirrors raise RequirementError("Selecting mirror region require a least one region to be given as an option.") + +def select_driver(options=AVAILABLE_GFX_DRIVERS): + """ + Some what convoluted function, which's job is simple. + Select a graphics driver from a pre-defined set of popular options. + + (The template xorg is for beginner users, not advanced, and should + there for appeal to the general public first and edge cases later) + """ + drivers = sorted(list(options)) + + if len(drivers) >= 1: + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') + print(' -- You need to select (and read about) which one you need. --') + + lspci = sys_command(f'/usr/bin/lspci') + for line in lspci.trace_log.split(b'\r\n'): + 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 **') + + selected_driver = input('Select your graphics card driver: ') + initial_option = selected_driver + + # Disabled search for now, only a few profiles exist anyway + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: + selected_driver = options[drivers[pos]] + elif selected_driver in options: + selected_driver = options[options.index(selected_driver)] + elif len(selected_driver) == 0: + raise RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") + else: + raise RequirementError("Selected driver does not exist.") + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + for index, driver_package_group in enumerate(driver_options): + print(f"{index}: {driver_package_group}") + + selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') + if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: + selected_driver_package_group = selected_driver[driver_options[pos]] + elif selected_driver_package_group in selected_driver: + selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] + elif len(selected_driver_package_group) == 0: + raise RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") + else: + raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") + + return selected_driver_package_group + + return selected_driver + + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file diff --git a/profiles/sway.py b/profiles/sway.py index 10e30753..f1d2c1f1 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -10,7 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() return True diff --git a/profiles/xorg.py b/profiles/xorg.py index 6ee72487..42597a37 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. -- cgit v1.2.3-70-g09d2 From fcd07b284e52cedc0a2f91fa6bd1d00cf675189b Mon Sep 17 00:00:00 2001 From: robsonsilv4 Date: Thu, 15 Apr 2021 23:33:04 -0300 Subject: Add Deepin desktop --- profiles/applications/deepin.py | 5 +++++ profiles/deepin.py | 37 +++++++++++++++++++++++++++++++++++++ profiles/desktop.py | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 profiles/applications/deepin.py create mode 100644 profiles/deepin.py (limited to 'profiles') diff --git a/profiles/applications/deepin.py b/profiles/applications/deepin.py new file mode 100644 index 00000000..0db1572d --- /dev/null +++ b/profiles/applications/deepin.py @@ -0,0 +1,5 @@ +import archinstall + +packages = "deepin deepin-terminal deepin-editor" + +installation.add_additional_packages(packages) diff --git a/profiles/deepin.py b/profiles/deepin.py new file mode 100644 index 00000000..52bcdde5 --- /dev/null +++ b/profiles/deepin.py @@ -0,0 +1,37 @@ +# A desktop environment using "Deepin". + +import archinstall, os + +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. + """ + + # Deepin 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("deepin", "/somewhere/deepin.py") +# or through conventional import deepin +if __name__ == 'deepin': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application deepin from the template under /applications/ + deepin = archinstall.Application(installation, 'deepin') + deepin.install() + + # Enable autostart of Deepin for all users + installation.enable_service('lightdm') diff --git a/profiles/desktop.py b/profiles/desktop.py index 846182e2..dce2e18b 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', 'budgie', 'mate'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate', 'deepin'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-70-g09d2 From a316846121caf4b26f96bed8dbe057b649cc409d Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Sat, 17 Apr 2021 16:35:21 +0300 Subject: Replace input with generic_select where necessary Here are list of changes: > From now on, `generic_select` will be called "Select function", for clarity - Slightly updated select function - Removed options output for some functions, where it's better to do with select function - Added sorting for all lists passed to select function - Replaced `dict.values()` with `dict` as options parameter - Simplified input checking for all functions that use the select function - Added temporary *(for now)* workaround for passing `?` and `help` inputs - Merged fix for `partition.format()` --- archinstall/lib/user_interaction.py | 109 +++++++++++++++--------------------- examples/guided.py | 6 +- profiles/desktop.py | 2 +- profiles/i3.py | 2 +- profiles/xorg.py | 32 +++-------- 5 files changed, 57 insertions(+), 94 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 57558e14..776650b5 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -154,9 +154,13 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage your internet connection', **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): ") + nic = generic_select(interfaces, "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} @@ -190,12 +194,12 @@ def ask_to_configure_network(): def ask_for_disk_layout(): options = { - 'keep-existing' : 'Keep existing partition layout and select which ones to use where.', - 'format-all' : 'Format entire drive and setup a basic partition scheme.', - 'abort' : 'Abort the installation.' + 'keep-existing' : 'Keep existing partition layout and select which ones to use where', + 'format-all' : 'Format entire drive and setup a basic partition scheme', + 'abort' : 'Abort the installation' } - value = generic_select(options.values(), "Found partitions on the selected drive, (select by number) what you want to do: ") + value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", False) return next((key for key, val in options.items() if val == value), None) def ask_for_main_filesystem_format(): @@ -206,7 +210,7 @@ def ask_for_main_filesystem_format(): 'f2fs' : 'f2fs' } - value = generic_select(options.values(), "Select which filesystem your main partition should use (by number or name): ") + value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", False) return next((key for key, val in options.items() if val == value), None) def generic_select(options, input_text="Select one of the above by index or absolute value: ", allow_empty_input=True, options_output=True): @@ -215,9 +219,12 @@ def generic_select(options, input_text="Select one of the above by index or abso other than the options and their indexes. As an example: generic_select(["first", "second", "third option"]) - 1: first - 2: second - 3: third option + 0: first + 1: second + 2: third option + + When the user has entered the option correctly, + this function returns an item from list, a string, or None """ # Checking if options are different from `list` or `dict` @@ -226,14 +233,14 @@ def generic_select(options, input_text="Select one of the above by index or abso log(" * Here are the link: https://github.com/archlinux/archinstall/issues * ", fg='yellow') raise RequirementError("generic_select() reqiures list or dictionary as options.") if type(options) == dict: options = sorted(list(options.values())) # To allow only `list` and `dict`, converting values of options and sorting them here. Therefore, now we can only provide the dictionary itself - # if sort: options = sorted(list(options)) # Moved sorting for dictionaries, as some lists are already sorted, when passed here if len(options) == 0: log(" * It looks like there are no options to choose from. Maybe it's time to open an issue on GitHub! * ", fg='red') log(" * Here are the link: https://github.com/archlinux/archinstall/issues * ", fg='yellow') raise RequirementError('generic_select() requires at least one option to operate.') - # Disable the output of options items, if another function displays something different from this + # Added ability to disable the output of options items, + # if another function displays something different from this if options_output: for index, option in enumerate(options): print(f"{index}: {option}") @@ -282,18 +289,10 @@ def select_disk(dict_o_disks): if len(drives) >= 1: for index, drive in enumerate(drives): print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})") - drive = input('Select one of the above disks (by number or full path) or write /mnt to skip partitioning: ') - if drive.strip() == '/mnt': - return None - elif drive.isdigit(): - drive = int(drive) - if drive >= len(drives): - raise DiskError(f'Selected option "{drive}" is out of range') - drive = dict_o_disks[drives[drive]] - elif drive in dict_o_disks: - drive = dict_o_disks[drive] - else: - raise DiskError(f'Selected drive does not exist: "{drive}"') + drive = generic_select(drives, 'Select one of the above disks (by number or full path) or leave blank to skip partitioning: ', True, False) + if not drive: + return drive + drive = dict_o_disks[drive] return drive raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.') @@ -312,24 +311,10 @@ def select_profile(options): profiles = sorted(list(options)) if len(profiles) >= 1: - for index, profile in enumerate(profiles): - print(f"{index}: {profile}") - - print(' -- The above list is a set of pre-programmed profiles. --') + print(' -- The below list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') - print(' -- (Leave blank and hit enter to skip this step and continue) --') - selected_profile = input('Enter a pre-programmed profile name if you want to install one: ') - - if len(selected_profile.strip()) <= 0: - return None - - if selected_profile.isdigit() and (pos := int(selected_profile)) <= len(profiles)-1: - selected_profile = profiles[pos] - elif selected_profile in options: - selected_profile = options[options.index(selected_profile)] - else: - RequirementError("Selected profile does not exist.") + selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one or leave blank to skip this step: ') return Profile(None, selected_profile) raise RequirementError("Selecting profiles require a least one profile to be given as an option.") @@ -359,12 +344,17 @@ def select_language(options, show_only_country_codes=True): for index, language in enumerate(languages): print(f"{index}: {language}") - print(' -- You can enter ? or help to search for more languages, or skip to use US layout --') - selected_language = input('Select one of the above keyboard languages (by number or full name): ') + # Current workaround for passing `generic_select`, + # if these values are provided as input + languages.extend(['?', 'help']) + languages_length = len(languages) + + print(f' -- You can enter ? ({languages_length - 2}) or help ({languages_length - 1}) to search for more languages, or skip to use US layout --') + selected_language = generic_select(languages, 'Select one of the above keyboard languages (by number or full name): ', True, False) - if len(selected_language.strip()) == 0: + if not selected_language: return DEFAULT_KEYBOARD_LANGUAGE - elif selected_language.lower() in ('?', 'help'): + elif selected_language in ('?', 'help'): while True: filter_string = input('Search for layout containing (example: "sv-"): ') new_options = list(search_keyboard_layout(filter_string)) @@ -375,18 +365,13 @@ def select_language(options, show_only_country_codes=True): return select_language(new_options, show_only_country_codes=False) - elif selected_language.isdigit() and (pos := int(selected_language)) <= len(languages)-1: - selected_language = languages[pos] - return selected_language # I'm leaving "options" on purpose here. # Since languages possibly contains a filtered version of # all possible language layouts, and we might want to write # for instance sv-latin1 (if we know that exists) without having to # go through the search step. - elif selected_language in languages: - return selected_language - else: - raise RequirementError("Selected language does not exist.") + + return selected_language raise RequirementError("Selecting languages require a least one language to be given as an option.") @@ -413,23 +398,17 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): print_large_list(regions, margin_bottom=4) print(' -- You can skip this step by leaving the option blank --') - selected_mirror = input('Select one of the above regions to download packages from (by number or full name): ') - if len(selected_mirror.strip()) == 0: + selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ', True, False) + if not selected_mirror: # Returning back empty options which can be both used to # do "if x:" logic as well as do `x.get('mirror', {}).get('sub', None)` chaining return {} - elif selected_mirror.isdigit() and int(selected_mirror) <= len(regions)-1: - # I'm leaving "mirrors" on purpose here. - # Since region possibly contains a known region of - # all possible regions, and we might want to write - # for instance Sweden (if we know that exists) without having to - # go through the search step. - region = regions[int(selected_mirror)] - selected_mirrors[region] = mirrors[region] - elif selected_mirror in mirrors: - selected_mirrors[selected_mirror] = mirrors[selected_mirror] - else: - raise RequirementError("Selected region does not exist.") + # I'm leaving "mirrors" on purpose here. + # Since region possibly contains a known region of + # all possible regions, and we might want to write + # for instance Sweden (if we know that exists) without having to + # go through the search step. + selected_mirrors[selected_mirror] = mirrors[selected_mirror] return selected_mirrors diff --git a/examples/guided.py b/examples/guided.py index c0d22023..89868148 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -76,7 +76,9 @@ def ask_user_questions(): archinstall.log(f" ** The root would be a simple / and the boot partition /boot (as all paths are relative inside the installation). **") while True: # Select a partition - partition = archinstall.generic_select(partition_mountpoints.keys(), + # If we provide keys as options, it's better to convert them to list and sort before passing + mountpoints_list = sorted(list(partition_mountpoints.keys())) + partition = archinstall.generic_select(mountpoints_list, "Select a partition by number that you want to set a mount-point for (leave blank when done): ") if not partition: break @@ -106,7 +108,7 @@ def ask_user_questions(): # we have to check if we support it. We can do this by formatting /dev/null with the partitions filesystem. # There's a nice wrapper for this on the partition object itself that supports a path-override during .format() try: - partition.format(new_filesystem, path='/dev/null', log_formating=False, allow_formatting=True) + partition.format(new_filesystem, path='/dev/null', log_formatting=False, allow_formatting=True) except archinstall.UnknownFilesystemFormat: archinstall.log(f"Selected filesystem is not supported yet. If you want archinstall to support '{new_filesystem}', please create a issue-ticket suggesting it on github at https://github.com/archlinux/archinstall/issues.") archinstall.log(f"Until then, please enter another supported filesystem.") diff --git a/profiles/desktop.py b/profiles/desktop.py index 846182e2..b46bf6fd 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -17,7 +17,7 @@ def _prep_function(*args, **kwargs): """ supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') + desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', False) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/i3.py b/profiles/i3.py index 67028b2d..fc427186 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -17,7 +17,7 @@ def _prep_function(*args, **kwargs): """ supported_configurations = ['i3-wm', 'i3-gaps'] - desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ') + desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', False) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/xorg.py b/profiles/xorg.py index e905d533..8c6f686d 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -33,10 +33,7 @@ def select_driver(options): drivers = sorted(list(options)) if len(drivers) >= 1: - for index, driver in enumerate(drivers): - print(f"{index}: {driver}") - - print(' -- The above list are supported graphic card drivers. --') + print(' -- The below list are supported graphic card drivers. --') print(' -- You need to select (and read about) which one you need. --') lspci = archinstall.sys_command(f'/usr/bin/lspci') @@ -47,7 +44,7 @@ def select_driver(options): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') - selected_driver = input('Select your graphics card driver: ') + selected_driver = archinstall.generic_select(drivers, 'Select your graphics card driver: ', False) initial_option = selected_driver # Disabled search for now, only a few profiles exist anyway @@ -57,29 +54,14 @@ def select_driver(options): # filter_string = input('Search for layout containing (example: "sv-"): ') # new_options = search_keyboard_layout(filter_string) # return select_language(new_options) - if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: - selected_driver = options[drivers[pos]] - elif selected_driver in options: - selected_driver = options[options.index(selected_driver)] - elif len(selected_driver) == 0: - raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") - else: - raise archinstall.RequirementError("Selected driver does not exist.") + + selected_driver = options[selected_driver] if type(selected_driver) == dict: driver_options = sorted(list(selected_driver)) - for index, driver_package_group in enumerate(driver_options): - print(f"{index}: {driver_package_group}") - - selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') - if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: - selected_driver_package_group = selected_driver[driver_options[pos]] - elif selected_driver_package_group in selected_driver: - selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] - elif len(selected_driver_package_group) == 0: - raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") - else: - raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.") + + selected_driver_package_group = archinstall.generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', False) + selected_driver_package_group = selected_driver[selected_driver_package_group] return selected_driver_package_group -- cgit v1.2.3-70-g09d2 From d2eacffff8e5ad560c55300477cdf28f475eb36c Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 19 Apr 2021 20:34:35 +0300 Subject: Update some functions Here are list of changes: - Added IP/subnet validation using Python's `ipaddress` module - Added workaround for network configuration modes where user can enter DHCP or IP without brackets. - Returned local printing options for some functions to keep `The above list...` - Moved booleans for `generic_select` below options and text parameters - Imported some functions from `archinstall` to reduce the`archinstall.` part of the lines. - Reduced variable name length for simplicity - Fixed some typos --- archinstall/lib/user_interaction.py | 67 ++++++++++++++++++++++++++++++------- profiles/desktop.py | 3 +- profiles/i3.py | 3 +- profiles/xorg.py | 22 +++++++----- 4 files changed, 72 insertions(+), 23 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 776650b5..b5c07f6a 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -1,5 +1,5 @@ import getpass, pathlib, os, shutil, re -import sys, time, signal +import sys, time, signal, ipaddress from .exceptions import * from .profiles import Profile from .locale_helpers import search_keyboard_layout @@ -164,13 +164,25 @@ def ask_to_configure_network(): 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)': + + # Current workaround: + # For selecting modes without entering text within brackets, + # printing out this part separate from options, passed in + # `generic_select` + modes = ['DHCP (auto detect)', 'IP (static)'] + for index, mode in enumerate(modes): + print(f"{index}: {mode}") + + mode = generic_select(['DHCP', 'IP'], f"Select which mode to configure for {nic} or leave blank for DHCP: ", + options_output=False) + if mode == 'IP': while 1: ip = input(f"Enter the IP and subnet for {nic} (example: 192.168.0.5/24): ").strip() - if ip: + # Implemented new check for correct IP/subnet input + try: + ipaddress.ip_interface(ip) break - else: + except ValueError: log( "You need to enter a valid IP in IP-config mode.", level=LOG_LEVELS.Warning, @@ -180,6 +192,25 @@ def ask_to_configure_network(): if not len(gateway := input('Enter your gateway (router) IP address or leave blank for none: ').strip()): gateway = None + # Assuming that gateway (router) IP address doesn't contain subnet, + # we can implement this check for it + # Implemented new check for correct IP input + + #gateway = input('Enter your gateway (router) IP address or leave blank for none: ').strip() + #while 1: + # try: + # if len(gateway) == 0: + # gateway = None + # else: + # ipaddress.ip_address(gateway) + # break + # except ValueError: + # log( + # "You need to enter a valid gateway (router) IP address.", + # level=LOG_LEVELS.Warning, + # fg='red' + # ) + dns = None if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') @@ -199,7 +230,8 @@ def ask_for_disk_layout(): 'abort' : 'Abort the installation' } - value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", False) + value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", + allow_empty_input=False) return next((key for key, val in options.items() if val == value), None) def ask_for_main_filesystem_format(): @@ -210,7 +242,8 @@ def ask_for_main_filesystem_format(): 'f2fs' : 'f2fs' } - value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", False) + value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", + allow_empty_input=False) return next((key for key, val in options.items() if val == value), None) def generic_select(options, input_text="Select one of the above by index or absolute value: ", allow_empty_input=True, options_output=True): @@ -231,7 +264,7 @@ def generic_select(options, input_text="Select one of the above by index or abso if type(options) not in [list, dict]: log(" * It looks like there are something wrong with provided options. Maybe it's time to open an issue on GitHub! * ", fg='red') log(" * Here are the link: https://github.com/archlinux/archinstall/issues * ", fg='yellow') - raise RequirementError("generic_select() reqiures list or dictionary as options.") + raise RequirementError("generic_select() requires list or dictionary as options.") if type(options) == dict: options = sorted(list(options.values())) # To allow only `list` and `dict`, converting values of options and sorting them here. Therefore, now we can only provide the dictionary itself if len(options) == 0: log(" * It looks like there are no options to choose from. Maybe it's time to open an issue on GitHub! * ", fg='red') @@ -289,7 +322,8 @@ def select_disk(dict_o_disks): if len(drives) >= 1: for index, drive in enumerate(drives): print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})") - drive = generic_select(drives, 'Select one of the above disks (by number or full path) or leave blank to skip partitioning: ', True, False) + drive = generic_select(drives, 'Select one of the above disks (by number or full path) or leave blank to skip partitioning: ', + options_output=False) if not drive: return drive drive = dict_o_disks[drive] @@ -311,10 +345,15 @@ def select_profile(options): profiles = sorted(list(options)) if len(profiles) >= 1: - print(' -- The below list is a set of pre-programmed profiles. --') + for index, profile in enumerate(profiles): + print(f"{index}: {profile}") + + print(' -- The above list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') + print(' -- (Leave blank and hit enter to skip this step and continue) --') - selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one or leave blank to skip this step: ') + selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one: ', + options_output=False) return Profile(None, selected_profile) raise RequirementError("Selecting profiles require a least one profile to be given as an option.") @@ -350,7 +389,8 @@ def select_language(options, show_only_country_codes=True): languages_length = len(languages) print(f' -- You can enter ? ({languages_length - 2}) or help ({languages_length - 1}) to search for more languages, or skip to use US layout --') - selected_language = generic_select(languages, 'Select one of the above keyboard languages (by number or full name): ', True, False) + selected_language = generic_select(languages, 'Select one of the above keyboard languages (by number or full name): ', + options_output=False) if not selected_language: return DEFAULT_KEYBOARD_LANGUAGE @@ -398,7 +438,8 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): print_large_list(regions, margin_bottom=4) print(' -- You can skip this step by leaving the option blank --') - selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ', True, False) + selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ', + options_output=False) if not selected_mirror: # Returning back empty options which can be both used to # do "if x:" logic as well as do `x.get('mirror', {}).get('sub', None)` chaining diff --git a/profiles/desktop.py b/profiles/desktop.py index b46bf6fd..d350cd71 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -17,7 +17,8 @@ def _prep_function(*args, **kwargs): """ supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', False) + desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', + allow_empty_input=False) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/i3.py b/profiles/i3.py index fc427186..923b2f2b 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -17,7 +17,8 @@ def _prep_function(*args, **kwargs): """ supported_configurations = ['i3-wm', 'i3-gaps'] - desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', False) + desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', + allow_empty_input=False) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/xorg.py b/profiles/xorg.py index 8c6f686d..130f3ed0 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -1,6 +1,7 @@ # A system with "xorg" installed -import archinstall, os +import os +from archinstall import generic_select, sys_command, RequirementError is_top_level_profile = True @@ -33,10 +34,13 @@ def select_driver(options): drivers = sorted(list(options)) if len(drivers) >= 1: - print(' -- The below list are supported graphic card drivers. --') + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') print(' -- You need to select (and read about) which one you need. --') - lspci = archinstall.sys_command(f'/usr/bin/lspci') + lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): if b'nvidia' in line.lower(): @@ -44,7 +48,8 @@ def select_driver(options): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') - selected_driver = archinstall.generic_select(drivers, 'Select your graphics card driver: ', False) + selected_driver = generic_select(drivers, 'Select your graphics card driver: ', + allow_empty_input=False, options_output=False) initial_option = selected_driver # Disabled search for now, only a few profiles exist anyway @@ -60,14 +65,15 @@ def select_driver(options): if type(selected_driver) == dict: driver_options = sorted(list(selected_driver)) - selected_driver_package_group = archinstall.generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', False) - selected_driver_package_group = selected_driver[selected_driver_package_group] + 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 selected_driver_package_group + return driver_package_group return selected_driver - raise archinstall.RequirementError("Selecting drivers require a least one profile to be given as an option.") + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-70-g09d2 From 1d04c9225873e21e92bc09290653450d161e067d Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Tue, 20 Apr 2021 14:45:54 +0300 Subject: Add sort parameter for generic_select Updated required features to support these change --- archinstall/lib/user_interaction.py | 9 ++++++--- profiles/desktop.py | 2 +- profiles/i3.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b5c07f6a..f2eae530 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -231,7 +231,7 @@ def ask_for_disk_layout(): } value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", - allow_empty_input=False) + allow_empty_input=False, sort=True) return next((key for key, val in options.items() if val == value), None) def ask_for_main_filesystem_format(): @@ -246,7 +246,7 @@ def ask_for_main_filesystem_format(): allow_empty_input=False) return next((key for key, val in options.items() if val == value), None) -def generic_select(options, input_text="Select one of the above by index or absolute value: ", allow_empty_input=True, options_output=True): +def generic_select(options, input_text="Select one of the above by index or absolute value: ", allow_empty_input=True, options_output=True, sort=False): """ A generic select function that does not output anything other than the options and their indexes. As an example: @@ -265,7 +265,10 @@ def generic_select(options, input_text="Select one of the above by index or abso log(" * It looks like there are something wrong with provided options. Maybe it's time to open an issue on GitHub! * ", fg='red') log(" * Here are the link: https://github.com/archlinux/archinstall/issues * ", fg='yellow') raise RequirementError("generic_select() requires list or dictionary as options.") - if type(options) == dict: options = sorted(list(options.values())) # To allow only `list` and `dict`, converting values of options and sorting them here. Therefore, now we can only provide the dictionary itself + # To allow only `list` and `dict`, converting values of options here. + # Therefore, now we can only provide the dictionary itself + if type(options) == dict: options = list(options.values()) + if sort: options = sorted(options) # As we pass only list and dict (converted to list), we can skip converting to list if len(options) == 0: log(" * It looks like there are no options to choose from. Maybe it's time to open an issue on GitHub! * ", fg='red') log(" * Here are the link: https://github.com/archlinux/archinstall/issues * ", fg='yellow') diff --git a/profiles/desktop.py b/profiles/desktop.py index d350cd71..2aea6d30 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -18,7 +18,7 @@ def _prep_function(*args, **kwargs): supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', - allow_empty_input=False) + allow_empty_input=False, sort=True) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/i3.py b/profiles/i3.py index 923b2f2b..b82c03d6 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -18,7 +18,7 @@ def _prep_function(*args, **kwargs): supported_configurations = ['i3-wm', 'i3-gaps'] desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', - allow_empty_input=False) + 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 7872d5b7facf07510bbe27789c7a2f6b5381673f Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 20 Apr 2021 19:23:18 +0530 Subject: rebase clean up --- profiles/budgie.py | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'profiles') diff --git a/profiles/budgie.py b/profiles/budgie.py index 1f224209..6c5475ae 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -1,13 +1,7 @@ -<<<<<<< HEAD:profiles/cinnamon.py -# A desktop environment using "Cinnamon" -import archinstall - -======= # A desktop environment using "budgie" import archinstall ->>>>>>> master:profiles/budgie.py is_top_level_profile = False def _prep_function(*args, **kwargs): @@ -18,11 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ -<<<<<<< HEAD:profiles/cinnamon.py - # Cinnamon requires a functioning Xorg installation. -======= # budgie requires a functioning Xorg installation. ->>>>>>> master:profiles/budgie.py profile = archinstall.Profile(None, 'xorg') with profile.load_instructions(namespace='xorg.py') as imported: if hasattr(imported, '_prep_function'): @@ -31,17 +21,6 @@ def _prep_function(*args, **kwargs): print('Deprecated (??): xorg profile has no _prep_function() anymore') # Ensures that this code only gets executed if executed -<<<<<<< HEAD:profiles/cinnamon.py -# through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") -# or through conventional import cinnamon -if __name__ == 'cinnamon': - # Install dependency profiles - installation.install_profile('xorg') - - # Install the application cinnamon from the template under /applications/ - cinnamon = archinstall.Application(installation, 'cinnamon') - cinnamon.install() -======= # through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") # or through conventional import budgie if __name__ == 'budgie': @@ -51,6 +30,5 @@ if __name__ == 'budgie': # Install the application budgie from the template under /applications/ budgie = archinstall.Application(installation, 'budgie') budgie.install() ->>>>>>> master:profiles/budgie.py installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From eb1ff72f5ba627e09da820b1ce0970d361653eca Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 17:00:51 +0530 Subject: readded some commits that got removed --- archinstall/lib/user_interaction.py | 54 ++++++++++++++++++++++++++++ profiles/sway.py | 6 ++++ profiles/xorg.py | 70 ------------------------------------- 3 files changed, 60 insertions(+), 70 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b0d8e138..d8d2df18 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,7 +7,11 @@ from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces from .general import sys_command +<<<<<<< HEAD from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI +======= +from .hardware import AVAILABLE_GFX_DRIVERS +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -465,7 +469,19 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): (The template xorg is for beginner users, not advanced, and should there for appeal to the general public first and edge cases later) """ +<<<<<<< HEAD if len(options) >= 1: +======= + drivers = sorted(list(options)) + + if len(drivers) >= 1: + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') + print(' -- You need to select (and read about) which one you need. --') + +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -474,6 +490,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') +<<<<<<< HEAD selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True) initial_option = selected_driver @@ -484,6 +501,39 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): if selected_driver_package_group in options[initial_option].keys(): print(options[initial_option][selected_driver_package_group]) selected_driver = options[initial_option][selected_driver_package_group] +======= + selected_driver = input('Select your graphics card driver: ') + initial_option = selected_driver + + # Disabled search for now, only a few profiles exist anyway + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: + selected_driver = options[drivers[pos]] + elif selected_driver in options: + selected_driver = options[options.index(selected_driver)] + elif len(selected_driver) == 0: + raise RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") + else: + raise RequirementError("Selected driver does not exist.") + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + for index, driver_package_group in enumerate(driver_options): + print(f"{index}: {driver_package_group}") + + selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') + if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: + selected_driver_package_group = selected_driver[driver_options[pos]] + elif selected_driver_package_group in selected_driver: + selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] + elif len(selected_driver_package_group) == 0: + raise RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. else: raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") @@ -491,4 +541,8 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver +<<<<<<< HEAD + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") +======= raise RequirementError("Selecting drivers require a least one profile to be given as an option.") +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. diff --git a/profiles/sway.py b/profiles/sway.py index 5633cce2..7fb64fd7 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,6 +11,12 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ +<<<<<<< HEAD +======= + + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() + +>>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. return True # Ensures that this code only gets executed if executed diff --git a/profiles/xorg.py b/profiles/xorg.py index 8e9779bc..4d54fe79 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -5,76 +5,6 @@ from archinstall import generic_select, sys_command, RequirementError is_top_level_profile = True -AVAILABLE_DRIVERS = { - # Sub-dicts are layer-2 options to be selected - # and lists are a list of packages to be installed - 'AMD / ATI' : { - 'amd' : ['xf86-video-amdgpu'], - 'ati' : ['xf86-video-ati'] - }, - 'intel' : ['xf86-video-intel'], - 'nvidia' : { - 'open source' : ['xf86-video-nouveau'], - 'proprietary' : ['nvidia'] - }, - 'mesa' : ['mesa'], - 'fbdev' : ['xf86-video-fbdev'], - 'vesa' : ['xf86-video-vesa'], - 'vmware' : ['xf86-video-vmware'] -} - -def select_driver(options): - """ - Some what convoluted function, which's job is simple. - Select a graphics driver from a pre-defined set of popular options. - - (The template xorg is for beginner users, not advanced, and should - there for appeal to the general public first and edge cases later) - """ - drivers = sorted(list(options)) - - if len(drivers) >= 1: - for index, driver in enumerate(drivers): - print(f"{index}: {driver}") - - print(' -- The above list are supported graphic card drivers. --') - print(' -- You need to select (and read about) which one you need. --') - - lspci = sys_command(f'/usr/bin/lspci') - for line in lspci.trace_log.split(b'\r\n'): - 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 **') - - selected_driver = generic_select(drivers, 'Select your graphics card driver: ', - allow_empty_input=False, options_output=False) - initial_option = selected_driver - - # Disabled search for now, only a few profiles exist anyway - # - #print(' -- You can enter ? or help to search for more drivers --') - #if selected_driver.lower() in ('?', 'help'): - # filter_string = input('Search for layout containing (example: "sv-"): ') - # new_options = search_keyboard_layout(filter_string) - # return select_language(new_options) - - selected_driver = options[selected_driver] - - 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 - - raise RequirementError("Selecting drivers require a least one profile to be given as an option.") - def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-70-g09d2 From e63eb26388eee05ba625b55ae1a1883e9ea340c1 Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 17:03:24 +0530 Subject: fixed merge conflicts --- archinstall/lib/user_interaction.py | 25 ------------------------- profiles/sway.py | 3 --- 2 files changed, 28 deletions(-) (limited to 'profiles') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index d8d2df18..befcb6d1 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -7,11 +7,7 @@ from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces from .general import sys_command -<<<<<<< HEAD -from .hardware import AVAILABLE_GFX_DRIVERS, hasUEFI -======= from .hardware import AVAILABLE_GFX_DRIVERS ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -469,9 +465,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): (The template xorg is for beginner users, not advanced, and should there for appeal to the general public first and edge cases later) """ -<<<<<<< HEAD - if len(options) >= 1: -======= drivers = sorted(list(options)) if len(drivers) >= 1: @@ -481,7 +474,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): print(' -- The above list are supported graphic card drivers. --') print(' -- You need to select (and read about) which one you need. --') ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -490,18 +482,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') -<<<<<<< HEAD - selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True) - initial_option = selected_driver - - if type(options[initial_option]) == dict: - driver_options = sorted(options[initial_option].keys()) - - selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ") - if selected_driver_package_group in options[initial_option].keys(): - print(options[initial_option][selected_driver_package_group]) - selected_driver = options[initial_option][selected_driver_package_group] -======= selected_driver = input('Select your graphics card driver: ') initial_option = selected_driver @@ -533,7 +513,6 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] elif len(selected_driver_package_group) == 0: raise RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. else: raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") @@ -541,8 +520,4 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): return selected_driver -<<<<<<< HEAD - raise RequirementError("Selecting drivers require a least one profile to be given as an option.") -======= raise RequirementError("Selecting drivers require a least one profile to be given as an option.") ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. diff --git a/profiles/sway.py b/profiles/sway.py index 7fb64fd7..53eb8c5a 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,12 +11,9 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ -<<<<<<< HEAD -======= __builtins__['_gfx_driver_packages'] = archinstall.select_driver() ->>>>>>> 1292c07... Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. return True # Ensures that this code only gets executed if executed -- cgit v1.2.3-70-g09d2 From 1188303fb3415c6ef428b312453afa8edf4d5a4d Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 22 Apr 2021 19:16:27 +0530 Subject: fixed another messed up import --- profiles/xorg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/xorg.py b/profiles/xorg.py index 4d54fe79..413a6308 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -2,7 +2,7 @@ import os from archinstall import generic_select, sys_command, RequirementError - +import archinstall is_top_level_profile = True def _prep_function(*args, **kwargs): -- cgit v1.2.3-70-g09d2 From 91fa98f48dc7c232d10bf501a133151db826cf34 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 22 Apr 2021 17:49:58 -0400 Subject: While somewhat nice to have, archlinux-wallpaper isn't needed in a minimal installation. --- profiles/applications/lxqt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py index 5ce875cc..2099f3fa 100644 --- a/profiles/applications/lxqt.py +++ b/profiles/applications/lxqt.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock archlinux-wallpaper sddm") +installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock sddm") -- cgit v1.2.3-70-g09d2 From 806e5fa3af1341588764267e34975203ddb293e6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Apr 2021 08:02:24 -0400 Subject: Delete i3-wm.py --- profiles/i3-wm.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 profiles/i3-wm.py (limited to 'profiles') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py deleted file mode 100644 index a2449e39..00000000 --- a/profiles/i3-wm.py +++ /dev/null @@ -1,42 +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. - """ - - # i3 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') -def _post_install(*args, **kwargs): - """ - Another magic function called after the system - has been installed. - """ - installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") - try: - subprocess.check_call("arch-chroot /mnt",shell=True) - except subprocess.CallProcessError: - return False - - return True - -if __name__ == 'i3-wm': - # Install dependency profiles - installation.install_profile('xorg') - # we are installing lightdm to auto start i3 - installation.add_additional_packages("lightdm-gtk-greeter lightdm") - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-wm') - i3.install() - # Auto start lightdm for all users - installation.enable_service('lightdm') -- cgit v1.2.3-70-g09d2 From 0fa99cf3cfcb14ee3cccf927dfcfa9dbfecb6f0c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Apr 2021 08:03:10 -0400 Subject: Delete i3-gaps.py --- profiles/i3-gaps.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 profiles/i3-gaps.py (limited to 'profiles') diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py deleted file mode 100644 index e900117a..00000000 --- a/profiles/i3-gaps.py +++ /dev/null @@ -1,43 +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. - """ - - # i3 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') - -def _post_install(*args, **kwargs): - """ - Another magic function called after the system - has been installed. - """ - installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") - try: - subprocess.check_call("arch-chroot /mnt",shell=True) - except subprocess.CallProcessError: - return False - - return True - -if __name__ == 'i3-wm': - # Install dependency profiles - installation.install_profile('xorg') - # gaps is installed by deafult so we are overriding it here - installation.add_additional_packages("lightdm-gtk-greeter lightdm") - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-gaps') - i3.install() - # Auto start lightdm for all users - installation.enable_service('lightdm') -- cgit v1.2.3-70-g09d2 From 8144ac736d0b190666aec03d2a57a41c01371946 Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 28 Apr 2021 09:35:07 +0530 Subject: install nvidia-dkms when running linux-zen/lts --- profiles/xorg.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/xorg.py b/profiles/xorg.py index 413a6308..cd89668d 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -25,7 +25,14 @@ def _prep_function(*args, **kwargs): # or through conventional import xorg if __name__ == 'xorg': try: - installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + if "nvidia" in _gfx_driver_packages: + if "linux-zen" in installation.base_packages or "linux-lts" in installation.base_packages: + installation.add_additional_packages("dkms")#I've had kernel regen fail if it wasn't installed before nvidia-dkms + installation.add_additional_packages("xorg-server xorg-xinit nvidia-dkms") + else: + installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + else: + installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") except: installation.add_additional_packages(f"xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install -- cgit v1.2.3-70-g09d2 From 0e89173ddf4827353874c611fba75f99d9693e27 Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 28 Apr 2021 09:37:22 +0530 Subject: Raise a hardware incompatibilty error if someone installs the nvidia prop dirvers with sway --- profiles/sway.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/sway.py b/profiles/sway.py index 53eb8c5a..f132df33 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -11,7 +11,8 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - + if "nvidia" in _gfx_driver_packages: + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers") __builtins__['_gfx_driver_packages'] = archinstall.select_driver() return True -- cgit v1.2.3-70-g09d2 From 3961f252c87e3811561e845a9689007d17e3628e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Apr 2021 07:43:28 -0400 Subject: Allow Sway Nvidia override --- profiles/sway.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/sway.py b/profiles/sway.py index f132df33..c3a6e31a 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -12,7 +12,10 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ if "nvidia" in _gfx_driver_packages: - raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers") + choice = input("The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues. Continue anyways? [y/N] ") + if choice.lower() in ("n", ""): + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers.") + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() return True -- cgit v1.2.3-70-g09d2 From e9d5cd1a112111a7fff48874bd39abaaf6f3e847 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:07:18 -0400 Subject: Rework budgie to use package definition --- profiles/budgie.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/profiles/budgie.py b/profiles/budgie.py index 6c5475ae..fc061cd2 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -4,6 +4,9 @@ import archinstall is_top_level_profile = False +# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki +__packages__ = ["budgie-desktop", "lightdm", "lightdm-gtk-greeter", "gnome"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -27,8 +30,7 @@ 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() + # Install the Budgie packages + installation.add_additional_packages(__packages__) installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From f319308d37ddf3dbfa6d62c500d61266f55771cd Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:08:50 -0400 Subject: Remove application profiles that just install additional packages and do not do anything else to customize or configure. --- profiles/applications/alacritty.py | 3 --- profiles/applications/budgie.py | 4 ---- profiles/applications/cinnamon.py | 3 --- profiles/applications/deepin.py | 5 ----- profiles/applications/gnome.py | 4 ---- profiles/applications/i3-gaps.py | 2 -- profiles/applications/i3-wm.py | 2 -- profiles/applications/kde.py | 5 ----- profiles/applications/lxqt.py | 3 --- profiles/applications/mate.py | 3 --- profiles/applications/sway.py | 3 --- profiles/applications/xfce4.py | 3 --- 12 files changed, 40 deletions(-) delete mode 100644 profiles/applications/alacritty.py delete mode 100644 profiles/applications/budgie.py delete mode 100644 profiles/applications/cinnamon.py delete mode 100644 profiles/applications/deepin.py delete mode 100644 profiles/applications/gnome.py delete mode 100644 profiles/applications/i3-gaps.py delete mode 100644 profiles/applications/i3-wm.py delete mode 100644 profiles/applications/kde.py delete mode 100644 profiles/applications/lxqt.py delete mode 100644 profiles/applications/mate.py delete mode 100644 profiles/applications/sway.py delete mode 100644 profiles/applications/xfce4.py (limited to 'profiles') diff --git a/profiles/applications/alacritty.py b/profiles/applications/alacritty.py deleted file mode 100644 index aab64bb4..00000000 --- a/profiles/applications/alacritty.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall - -installation.add_additional_packages("alacritty") \ No newline at end of file diff --git a/profiles/applications/budgie.py b/profiles/applications/budgie.py deleted file mode 100644 index ccec4e14..00000000 --- a/profiles/applications/budgie.py +++ /dev/null @@ -1,4 +0,0 @@ -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 gnome") \ No newline at end of file diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py deleted file mode 100644 index 0a1d9cc2..00000000 --- a/profiles/applications/cinnamon.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall - -installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter") diff --git a/profiles/applications/deepin.py b/profiles/applications/deepin.py deleted file mode 100644 index 0db1572d..00000000 --- a/profiles/applications/deepin.py +++ /dev/null @@ -1,5 +0,0 @@ -import archinstall - -packages = "deepin deepin-terminal deepin-editor" - -installation.add_additional_packages(packages) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py deleted file mode 100644 index e26290dc..00000000 --- a/profiles/applications/gnome.py +++ /dev/null @@ -1,4 +0,0 @@ -import archinstall - -installation.add_additional_packages("gnome gnome-tweaks gdm") -# Note: gdm should be part of the gnome group, but adding it here for clarity diff --git a/profiles/applications/i3-gaps.py b/profiles/applications/i3-gaps.py deleted file mode 100644 index 4daed7ad..00000000 --- a/profiles/applications/i3-gaps.py +++ /dev/null @@ -1,2 +0,0 @@ -import archinstall -installation.add_additional_packages("i3-gaps") \ No newline at end of file diff --git a/profiles/applications/i3-wm.py b/profiles/applications/i3-wm.py deleted file mode 100644 index e7838a64..00000000 --- a/profiles/applications/i3-wm.py +++ /dev/null @@ -1,2 +0,0 @@ -import archinstall -installation.add_additional_packages("i3-wm") \ No newline at end of file diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py deleted file mode 100644 index af1e6597..00000000 --- a/profiles/applications/kde.py +++ /dev/null @@ -1,5 +0,0 @@ -import archinstall -packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" -if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" -installation.add_additional_packages(packages) diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py deleted file mode 100644 index 2099f3fa..00000000 --- a/profiles/applications/lxqt.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall - -installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock sddm") diff --git a/profiles/applications/mate.py b/profiles/applications/mate.py deleted file mode 100644 index 24d6be47..00000000 --- a/profiles/applications/mate.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall - -installation.add_additional_packages("mate mate-extra lightdm lightdm-gtk-greeter") \ No newline at end of file diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py deleted file mode 100644 index 59921aa0..00000000 --- a/profiles/applications/sway.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall -__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 deleted file mode 100644 index 9f4260da..00000000 --- a/profiles/applications/xfce4.py +++ /dev/null @@ -1,3 +0,0 @@ -import archinstall -__packages__ = "xfce4 xfce4-goodies lightdm lightdm-gtk-greeter" -installation.add_additional_packages(__packages__) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 8706b48097f0fdb8eab7a612378bc3352ec00c18 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:10:08 -0400 Subject: Restore kde.py --- profiles/applications/kde.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 profiles/applications/kde.py (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py new file mode 100644 index 00000000..af1e6597 --- /dev/null +++ b/profiles/applications/kde.py @@ -0,0 +1,5 @@ +import archinstall +packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" +if "nvidia" in _gfx_driver_packages: + packages = packages + " egl-wayland" +installation.add_additional_packages(packages) -- cgit v1.2.3-70-g09d2 From 2d4326b6c5dd117094dd68f533bb15e997ae1571 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:11:36 -0400 Subject: Rework how alacritty is installed for awesome --- profiles/applications/kde.py | 3 +++ profiles/awesome.py | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index af1e6597..150fc0e3 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,5 +1,8 @@ import archinstall + packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" + if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" + installation.add_additional_packages(packages) diff --git a/profiles/awesome.py b/profiles/awesome.py index cbd52a3c..694a4f9d 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -6,7 +6,7 @@ is_top_level_profile = False # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". -__packages__ = ['nemo', 'gpicview-gtk3', 'scrot'] +__packages__ = ['nemo', 'gpicview-gtk3', 'scrot', 'alacritty'] def _prep_function(*args, **kwargs): """ @@ -35,9 +35,6 @@ if __name__ == 'awesome': installation.add_additional_packages(__packages__) - alacritty = archinstall.Application(installation, 'alacritty') - alacritty.install() - # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead. with open(f'{installation.target}/etc/xdg/awesome/rc.lua', 'r') as fh: awesome_lua = fh.read() -- cgit v1.2.3-70-g09d2 From 23a9e9f69a76adb1015ab80ea84ffdae86cefb09 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:13:16 -0400 Subject: Change how i3 configurations are installed --- profiles/i3.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/i3.py b/profiles/i3.py index b82c03d6..f071714a 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -60,5 +60,4 @@ if __name__ == 'i3': installation.enable_service('lightdm') # install the i3 group now - i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) - i3.install() + installation.add_additional_packages(installation, archinstall.storage['_i3_configuration']) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From f91c0137d5f9a5f01229f21e62e81e52e41635ce Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:14:18 -0400 Subject: Remove refs to application profiles that were removed --- profiles/cinnamon.py | 5 ++--- profiles/deepin.py | 5 ++--- profiles/gnome.py | 5 ++--- profiles/lxqt.py | 5 ++--- profiles/mate.py | 5 ++--- profiles/sway.py | 5 ++--- profiles/xfce4.py | 5 ++--- 7 files changed, 14 insertions(+), 21 deletions(-) (limited to 'profiles') diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 91a59811..a8b89031 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -27,8 +27,7 @@ if __name__ == 'cinnamon': # Install dependency profiles installation.install_profile('xorg') - # Install the application cinnamon from the template under /applications/ - cinnamon = archinstall.Application(installation, 'cinnamon') - cinnamon.install() + # Install the Cinnamon packages + installation.add_additional_packages(__packages__) installation.enable_service('lightdm') # Light Display Manager diff --git a/profiles/deepin.py b/profiles/deepin.py index 52bcdde5..f476f7e3 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -29,9 +29,8 @@ if __name__ == 'deepin': # Install dependency profiles installation.install_profile('xorg') - # Install the application deepin from the template under /applications/ - deepin = archinstall.Application(installation, 'deepin') - deepin.install() + # Install the Deepin packages + installation.add_additional_packages(__packages__) # Enable autostart of Deepin for all users installation.enable_service('lightdm') diff --git a/profiles/gnome.py b/profiles/gnome.py index c75cafee..cc80a606 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -28,9 +28,8 @@ if __name__ == 'gnome': # Install dependency profiles installation.install_profile('xorg') - # Install the application gnome from the template under /applications/ - gnome = archinstall.Application(installation, 'gnome') - gnome.install() + # Install the GNOME packages + installation.add_additional_packages(__packages__) installation.enable_service('gdm') # Gnome Display Manager # We could also start it via xinitrc since we do have Xorg, diff --git a/profiles/lxqt.py b/profiles/lxqt.py index 871488ee..e1ac8ab7 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -28,8 +28,7 @@ if __name__ == 'lxqt': # Install dependency profiles installation.install_profile('xorg') - # Install the application xfce4 from the template under /applications/ - xfce = archinstall.Application(installation, 'lxqt') - xfce.install() + # Install the LXQt packages + installation.add_additional_packages(__packages__) installation.enable_service('sddm') # SDDM Display Manager diff --git a/profiles/mate.py b/profiles/mate.py index b4c697b1..3b48d0ab 100644 --- a/profiles/mate.py +++ b/profiles/mate.py @@ -27,8 +27,7 @@ if __name__ == 'mate': # Install dependency profiles installation.install_profile('xorg') - # Install the application mate from the template under /applications/ - mate = archinstall.Application(installation, 'mate') - mate.install() + # Install the MATE packages + installation.add_additional_packages(__packages__) installation.enable_service('lightdm') # Light Display Manager diff --git a/profiles/sway.py b/profiles/sway.py index c3a6e31a..84ea049b 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -24,6 +24,5 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("sway", "/somewhere/sway.py") # or through conventional import sway if __name__ == 'sway': - # Install the application sway from the template under /applications/ - sway = archinstall.Application(installation, 'sway') - sway.install() + # Install the Sway packages + installation.add_additional_packages(__packages__) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index fee8c37a..ffe4a3c0 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -28,8 +28,7 @@ if __name__ == 'xfce4': # Install dependency profiles installation.install_profile('xorg') - # Install the application xfce4 from the template under /applications/ - xfce = archinstall.Application(installation, 'xfce4') - xfce.install() + # Install the XFCE4 packages + installation.add_additional_packages(__packages__) installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-70-g09d2 From 6013e06fb134eb6d07764aea778399baccd49d21 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:20:00 -0400 Subject: Add packages to top of each desktop profile --- profiles/cinnamon.py | 2 ++ profiles/deepin.py | 1 + profiles/gnome.py | 3 +++ profiles/kde.py | 2 ++ profiles/lxqt.py | 2 ++ profiles/mate.py | 2 ++ profiles/sway.py | 2 ++ profiles/xfce4.py | 2 ++ 8 files changed, 16 insertions(+) (limited to 'profiles') diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index a8b89031..4ca9cfed 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -4,6 +4,8 @@ import archinstall is_top_level_profile = False +__packages__ = ["cinnamon", "system-config-printer", "gnome-keyring", "gnome-terminal", "blueberry", "metacity", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/deepin.py b/profiles/deepin.py index f476f7e3..ce59a699 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -4,6 +4,7 @@ import archinstall, os is_top_level_profile = False +__packages__ = ["deepin", "deepin-terminal", "deepin-editor"] def _prep_function(*args, **kwargs): """ diff --git a/profiles/gnome.py b/profiles/gnome.py index cc80a606..a480d713 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -4,6 +4,9 @@ import archinstall is_top_level_profile = False +# Note: GDM should be part of the gnome group, but adding it here for clarity +__packages__ = ["gnome". "gnome-tweaks", "gdm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/kde.py b/profiles/kde.py index 6654dfa7..28460cbc 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -4,6 +4,8 @@ import archinstall, os is_top_level_profile = False +__packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-wayland-session"] + # TODO: Remove hard dependency of bash (due to .bash_profile) def _prep_function(*args, **kwargs): diff --git a/profiles/lxqt.py b/profiles/lxqt.py index e1ac8ab7..d0727a90 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -5,6 +5,8 @@ import archinstall is_top_level_profile = False +__packages__ = ["lxqt", "breeze-icons", "oxygen-icons", "xdg-utils", "ttf-freefont", "leafpad", "slock", "sddm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/mate.py b/profiles/mate.py index 3b48d0ab..2cfe7305 100644 --- a/profiles/mate.py +++ b/profiles/mate.py @@ -4,6 +4,8 @@ import archinstall is_top_level_profile = False +__packages__ = ["mate", "mate-extra", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/sway.py b/profiles/sway.py index 84ea049b..db94ae2c 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -4,6 +4,8 @@ import archinstall is_top_level_profile = False +__packages__ = ["sway", "swaylock", "swayidle", "waybar", "dmenu", "light", "grim", "slurp", "pavucontrol", "alacritty"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/xfce4.py b/profiles/xfce4.py index ffe4a3c0..8102919b 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -5,6 +5,8 @@ import archinstall is_top_level_profile = False +__packages__ = ["xfce4", "xfce4-goodies", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-70-g09d2 From fd042053be741edaac8d967899d4b9cb1c4a913b Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:21:24 -0400 Subject: Rework KDE profile package installation --- profiles/applications/kde.py | 2 +- profiles/kde.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index 150fc0e3..a3332130 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,6 +1,6 @@ import archinstall -packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" +packages = "" # Other packages for KDE are installed in the main profile now. if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" diff --git a/profiles/kde.py b/profiles/kde.py index 28460cbc..1c98237b 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -39,7 +39,10 @@ if __name__ == 'kde': # Install dependency profiles installation.install_profile('xorg') - # Install the application kde from the template under /applications/ + # Install the KDE packages + installation.add_additional_packages(__packages__) + + # Run KDE application configuration kde = archinstall.Application(installation, 'kde') kde.install() -- cgit v1.2.3-70-g09d2 From f9f359ab73dabb74543909af5e98adb6c56a189d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Apr 2021 11:30:30 -0400 Subject: This variable wasn't really needed. --- profiles/applications/kde.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index a3332130..eacba708 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,8 +1,6 @@ import archinstall -packages = "" # Other packages for KDE are installed in the main profile now. +# Other packages for KDE are installed in the main profile now. if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" - -installation.add_additional_packages(packages) + installation.add_additional_packages("egl-wayland") -- cgit v1.2.3-70-g09d2 From 1238199ed8022fbfaedcf746527b5d8c1ad975b9 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 28 Apr 2021 11:44:12 -0400 Subject: egl-wayland is small enough that conditionally installing it doesn't make a lot of sense --- profiles/applications/kde.py | 6 ------ profiles/kde.py | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 profiles/applications/kde.py (limited to 'profiles') diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py deleted file mode 100644 index eacba708..00000000 --- a/profiles/applications/kde.py +++ /dev/null @@ -1,6 +0,0 @@ -import archinstall - -# Other packages for KDE are installed in the main profile now. - -if "nvidia" in _gfx_driver_packages: - installation.add_additional_packages("egl-wayland") diff --git a/profiles/kde.py b/profiles/kde.py index 1c98237b..c8efdcde 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -4,7 +4,7 @@ import archinstall, os is_top_level_profile = False -__packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-wayland-session"] +__packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-wayland-session", "egl-wayland"] # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -42,9 +42,5 @@ if __name__ == 'kde': # Install the KDE packages installation.add_additional_packages(__packages__) - # Run KDE application configuration - kde = archinstall.Application(installation, 'kde') - kde.install() - # Enable autostart of KDE for all users installation.enable_service('sddm') -- cgit v1.2.3-70-g09d2 From 2d02e806f2ae5341752a0ceb532e5c239a164ee7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 29 Apr 2021 08:18:43 +0000 Subject: Cleaning up packages. (#374) * Cleaning up packages. installer now relies on __packages__ definition. Which will work with external libs to more easily gather packages used by installer and profiles. * Added back the logic for the log message, where we inform if we're adding the boot loader to root or boot. * Added __package__ definition to profiles and the installer. These packages can be used as an indication from outside libraries of what could *possibly* be installed. For instance an offline-tool could source these, it would source more than it needed to, but it would give a quick rundown of what might be needed. * Removed import of __base__packages__ as it's now just __packages__ after a lot of stream-lining. * Explosion misspelling. Co-authored-by: Anton Hvornum --- archinstall/__init__.py | 2 +- archinstall/lib/hardware.py | 4 +++- archinstall/lib/installer.py | 21 +++++++++------------ profiles/52-54-00-12-34-56.py | 14 ++++++-------- profiles/awesome.py | 2 +- profiles/i3.py | 8 ++++---- profiles/xorg.py | 4 +++- 7 files changed, 27 insertions(+), 28 deletions(-) (limited to 'profiles') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index bc58af54..e2c7ea62 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -3,7 +3,7 @@ from .lib.general import * from .lib.disk import * from .lib.user_interaction import * from .lib.exceptions import * -from .lib.installer import __packages__, __base_packages__, Installer +from .lib.installer import __packages__, Installer from .lib.profiles import * from .lib.luks import * from .lib.mirrors import * diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index d6cf982c..e9c63e41 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -3,6 +3,8 @@ from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes from typing import Optional +__packages__ = ['xf86-video-amdgpu', 'xf86-video-ati', 'xf86-video-intel', 'xf86-video-nouveau', 'xf86-video-fbdev', 'xf86-video-vesa', 'xf86-video-vmware', 'nvidia', 'mesa'] + AVAILABLE_GFX_DRIVERS = { # Sub-dicts are layer-2 options to be selected # and lists are a list of packages to be installed @@ -18,7 +20,7 @@ AVAILABLE_GFX_DRIVERS = { 'mesa' : ['mesa'], 'fbdev' : ['xf86-video-fbdev'], 'vesa' : ['xf86-video-vesa'], - 'vmware' : ['xf86-video-vmware'] + 'vmware / virtualbox' : ['xf86-video-vmware'] } def hasWifi()->bool: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a5449662..dbc6d1b4 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -12,8 +12,7 @@ from .storage import storage from .hardware import * # Any package that the Installer() is responsible for (optional and the default ones) -__packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] -__base_packages__ = __packages__[:6] +__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"] class Installer(): """ @@ -39,8 +38,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages='base base-devel linux-firmware', kernels='linux'): - kernels = kernels.split(",") + def __init__(self, target, *, base_packages=__packages__[:3], kernels=['linux']): self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) @@ -53,10 +51,7 @@ class Installer(): self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages for kernel in kernels: self.base_packages.append(kernel) - if hasUEFI(): - self.base_packages.append("efibootmgr") - else: - self.base_packages.append("grub") + self.post_base_install = [] storage['session'] = self @@ -364,12 +359,12 @@ class Installer(): boot_partition = partition elif partition.mountpoint == self.target: root_partition = partition - if hasUEFI(): - self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=logging.INFO) - else: - self.log(f'Adding bootloader {bootloader} to {root_partition}', level=logging.INFO) + + self.log(f'Adding bootloader {bootloader} to {boot_partition if boot_partition else root_partition}', level=logging.INFO) if bootloader == 'systemd-bootctl': + self.pacstrap('efibootmgr') + if not hasUEFI(): raise HardwareIncompatibilityError # TODO: Ideally we would want to check if another config @@ -432,6 +427,8 @@ class Installer(): raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.") elif bootloader == "grub-install": + self.pacstrap('grub') + if hasUEFI(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index ed2c9d78..442e053c 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -1,7 +1,8 @@ import archinstall import json import urllib.request -import git + +__packages__ = ['nano', 'wget', 'git'] # Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.) archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) @@ -30,22 +31,19 @@ with archinstall.Filesystem(harddrive) as fs: if installation.minimal_installation(): installation.add_bootloader() - installation.add_additional_packages(['nano', 'wget', 'git']) + installation.add_additional_packages(__packages__) installation.install_profile('awesome') - installation.user_create('anton', 'test') + installation.user_create('devel', 'devel') installation.user_set_pw('root', 'toor') - repo = git.Repo('./') - commit = repo.head.commit.hexsha[:7] - - print(f'Submitting {commit}: success') + print(f'Submitting {archinstall.__version__}: success') conditions = { "project": "archinstall", "profile": "52-54-00-12-34-56", "status": "success", - "commit": commit + "version": archinstall.__version__ } req = urllib.request.Request("https://api.archlinux.life/build/success", data=json.dumps(conditions).encode('utf8'), diff --git a/profiles/awesome.py b/profiles/awesome.py index cbd52a3c..01566d0f 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -6,7 +6,7 @@ is_top_level_profile = False # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". -__packages__ = ['nemo', 'gpicview-gtk3', 'scrot'] +__packages__ = ['nemo', 'gpicview-gtk3', 'maim'] def _prep_function(*args, **kwargs): """ diff --git a/profiles/i3.py b/profiles/i3.py index b82c03d6..148e591e 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -6,7 +6,7 @@ is_top_level_profile = False # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". -__packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm'] +__packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm'] def _prep_function(*args, **kwargs): """ @@ -48,13 +48,13 @@ if __name__ == 'i3': """ # Install common packages for all i3 configurations - installation.add_additional_packages(__packages__) + installation.add_additional_packages(__packages__[:4]) # Install dependency profiles installation.install_profile('xorg') - # gaps is installed by deafult so we are overriding it here - installation.add_additional_packages("lightdm-gtk-greeter lightdm") + # gaps is installed by deafult so we are overriding it here with lightdm + installation.add_additional_packages(__packages__[4:]) # Auto start lightdm for all users installation.enable_service('lightdm') diff --git a/profiles/xorg.py b/profiles/xorg.py index cd89668d..7546a01b 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -1,10 +1,12 @@ # A system with "xorg" installed import os -from archinstall import generic_select, sys_command, RequirementError import archinstall + is_top_level_profile = True +__packages__ = ['dkms', 'xorg-server', 'xorg-xinit', 'nvidia-dkms', 'xorg-server', *archinstall.lib.hardware.__packages__] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-70-g09d2 From 16a1a006431e5d6ac39f6b54e70a8d2511ebfa17 Mon Sep 17 00:00:00 2001 From: Jatin <40650341+jatin-cbs@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:50:01 +0530 Subject: Fixed a typo in the last PR https://github.com/archlinux/archinstall/pull/378 replaced a `.` with a `,` in gnome.py profile. --- profiles/gnome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/gnome.py b/profiles/gnome.py index a480d713..77c90859 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -5,7 +5,7 @@ import archinstall is_top_level_profile = False # Note: GDM should be part of the gnome group, but adding it here for clarity -__packages__ = ["gnome". "gnome-tweaks", "gdm"] +__packages__ = ["gnome", "gnome-tweaks", "gdm"] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-70-g09d2 From eb2174eef92208da9b3e5ea80df54e216b68313b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 06:57:52 -0400 Subject: Add nginx profile --- profiles/applications/nginx.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/nginx.py (limited to 'profiles') diff --git a/profiles/applications/nginx.py b/profiles/applications/nginx.py new file mode 100644 index 00000000..50eb0506 --- /dev/null +++ b/profiles/applications/nginx.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["nginx"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('nginx') -- cgit v1.2.3-70-g09d2 From 5c6cd59aecde69c85676235ef0e739fba59a55fd Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 07:03:57 -0400 Subject: Add Apache HTTPD Application Profile --- profiles/applications/httpd.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/httpd.py (limited to 'profiles') diff --git a/profiles/applications/httpd.py b/profiles/applications/httpd.py new file mode 100644 index 00000000..00d64b6e --- /dev/null +++ b/profiles/applications/httpd.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["apache"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('httpd') -- cgit v1.2.3-70-g09d2 From 9e8446a96abbd406fa8c037d008d0ada593de227 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 07:09:46 -0400 Subject: Add Tomcat application profile Using Tomcat 10 as that is the latest release --- profiles/applications/tomcat.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 profiles/applications/tomcat.py (limited to 'profiles') diff --git a/profiles/applications/tomcat.py b/profiles/applications/tomcat.py new file mode 100644 index 00000000..9c521390 --- /dev/null +++ b/profiles/applications/tomcat.py @@ -0,0 +1,12 @@ +import archinstall + +# This is using Tomcat 10 as that is the latest release at the time of implementation. +# This should probably be updated to use newer releases as they come out. + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["tomcat10"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('tomcat10') -- cgit v1.2.3-70-g09d2 From 5cf0419073699ef476d21feacb50f06cf96e4f94 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 07:14:34 -0400 Subject: Add Docker Application Profile --- profiles/applications/docker.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/docker.py (limited to 'profiles') diff --git a/profiles/applications/docker.py b/profiles/applications/docker.py new file mode 100644 index 00000000..afa3f8fb --- /dev/null +++ b/profiles/applications/docker.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["docker"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('docker') -- cgit v1.2.3-70-g09d2 From 9d5e9333c7a44dbdf6d3008a6ba61620b7e4d040 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 07:18:38 -0400 Subject: Add lighttpd application profile --- profiles/applications/lighttpd.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/lighttpd.py (limited to 'profiles') diff --git a/profiles/applications/lighttpd.py b/profiles/applications/lighttpd.py new file mode 100644 index 00000000..a1e6a371 --- /dev/null +++ b/profiles/applications/lighttpd.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["lighttpd"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('lighttpd') -- cgit v1.2.3-70-g09d2 From 0ebc6be7ae3b153f2baad722a08a2019bb04c905 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 29 Apr 2021 11:32:21 +0000 Subject: Added a postgresql application profile. (#383) * Added a postgres application profile. Also introducing runas to the arch_chroot of the installation, to run commands as emulated users. This is highly WIP at the moment. * Fixing top-level-listing of profiles. As well as testing some postgres installation steps. * Removed dupe functions. * Added safety check in case a comment mentions the top level profile thing. * Patching namespace corruption. * Avoiding runtime collision due to installation not being initiated yet. * Allow for parameterization of filesystem in guided. Co-authored-by: Anton Hvornum --- archinstall/lib/disk.py | 1 - archinstall/lib/installer.py | 3 +++ archinstall/lib/profiles.py | 53 +++++++------------------------------ examples/guided.py | 6 +++-- profiles/52-54-00-12-34-56.py | 8 +++++- profiles/applications/postgresql.py | 11 ++++++++ 6 files changed, 34 insertions(+), 48 deletions(-) create mode 100644 profiles/applications/postgresql.py (limited to 'profiles') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index ff924f62..49bef1be 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -471,7 +471,6 @@ class Filesystem(): def raw_parted(self, string:str): x = sys_command(f'/usr/bin/parted -s {string}') - log(f"'parted -s {string}' returned: {b''.join(x)}", level=logging.DEBUG) return x def parted(self, string:str): diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index dbc6d1b4..a7b36481 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -196,6 +196,9 @@ class Installer(): return sys_command(f'/usr/bin/arch-chroot {self.target} {cmd}') def arch_chroot(self, cmd, *args, **kwargs): + if 'runas' in kwargs: + cmd = f"su - {kwargs['runas']} -c \"{cmd}\"" + return self.run_command(cmd) def drop_to_shell(self): diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index ad5d3bac..06237c1c 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -92,6 +92,9 @@ class Script(): if len(args) >= 2 and args[1]: raise args[1] + if self.original_namespace: + self.namespace = self.original_namespace + def localize_path(self, profile_path): if (url := urllib.parse.urlparse(profile_path)).scheme and url.scheme in ('https', 'http'): if not self.converted_path: @@ -202,51 +205,14 @@ class Profile(Script): with open(self.path, 'r') as source: source_data = source.read() - # TODO: I imagine that there is probably a better way to write this. - return 'top_level_profile = True' in source_data - - @property - def packages(self) -> list: - """ - Returns a list of packages baked into the profile definition. - If no package definition has been done, .packages() will return None. - """ - with open(self.path, 'r') as source: - source_data = source.read() - - # Some crude safety checks, make sure the imported profile has - # a __name__ check before importing. - # - # If the requirements are met, import with .py in the namespace to not - # trigger a traditional: - # if __name__ == 'moduleName' - if '__name__' in source_data and '__packages__' in source_data: - with self.load_instructions(namespace=f"{self.namespace}.py") as imported: - if hasattr(imported, '__packages__'): - return imported.__packages__ - return None - - - def has_post_install(self): - with open(self.path, 'r') as source: - source_data = source.read() - - # Some crude safety checks, make sure the imported profile has - # a __name__ check and if so, check if it's got a _prep_function() - # we can call to ask for more user input. - # - # If the requirements are met, import with .py in the namespace to not - # trigger a traditional: - # if __name__ == 'moduleName' - if '__name__' in source_data and '_post_install' in source_data: + if '__name__' in source_data and 'is_top_level_profile' in source_data: with self.load_instructions(namespace=f"{self.namespace}.py") as imported: - if hasattr(imported, '_post_install'): - return True + if hasattr(imported, 'is_top_level_profile'): + return imported.is_top_level_profile - def is_top_level_profile(self): - with open(self.path, 'r') as source: - source_data = source.read() - return 'top_level_profile = True' in source_data + # Default to True if nothing is specified, + # since developers like less code - omitting it should assume they want to present it. + return True @property def packages(self) -> list: @@ -268,7 +234,6 @@ class Profile(Script): if hasattr(imported, '__packages__'): return imported.__packages__ return None - class Application(Profile): def __repr__(self, *args, **kwargs): diff --git a/examples/guided.py b/examples/guided.py index 2b8a06f5..c281d033 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -136,12 +136,14 @@ def ask_user_questions(): archinstall.log('Using existing partition table reported above.') elif option == 'format-all': - archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() + if not archinstall.arguments.get('filesystem', None): + archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() archinstall.arguments['harddrive'].keep_partitions = False elif archinstall.arguments['harddrive']: # If the drive doesn't have any partitions, safely mark the disk with keep_partitions = False # and ask the user for a root filesystem. - archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() + if not archinstall.arguments.get('filesystem', None): + archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() archinstall.arguments['harddrive'].keep_partitions = False # Get disk encryption password (or skip if blank) diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index 442e053c..a3347760 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -4,6 +4,11 @@ import urllib.request __packages__ = ['nano', 'wget', 'git'] +if __name__ == '52-54-00-12-34-56': + awesome = archinstall.Application(installation, 'postgresql') + awesome.install() + +""" # Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.) archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True) @@ -51,4 +56,5 @@ with archinstall.Filesystem(harddrive) as fs: try: urllib.request.urlopen(req, timeout=5) except: - pass \ No newline at end of file + pass +""" \ No newline at end of file diff --git a/profiles/applications/postgresql.py b/profiles/applications/postgresql.py new file mode 100644 index 00000000..fcdce824 --- /dev/null +++ b/profiles/applications/postgresql.py @@ -0,0 +1,11 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["postgresql"] + +installation.add_additional_packages(__packages__) + +installation.arch_chroot("initdb -D /var/lib/postgres/data", runas='postgres') + +installation.enable_service('postgresql') \ No newline at end of file -- cgit v1.2.3-70-g09d2 From f7cb4c8fb9b5fbb8789ba988d77d2a58a70634c1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 07:33:46 -0400 Subject: Add MariaDB Application Profile (#386) --- profiles/applications/mariadb.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 profiles/applications/mariadb.py (limited to 'profiles') diff --git a/profiles/applications/mariadb.py b/profiles/applications/mariadb.py new file mode 100644 index 00000000..e458a45a --- /dev/null +++ b/profiles/applications/mariadb.py @@ -0,0 +1,11 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["mariadb"] + +installation.add_additional_packages(__packages__) + +installation.arch_chroot("mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql") + +installation.enable_service('mariadb') -- cgit v1.2.3-70-g09d2 From c3bb503fab0cca1b5eb92a13b9aac40c4686141e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 08:01:15 -0400 Subject: Add SSH Server Application Profile --- profiles/applications/sshd.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/sshd.py (limited to 'profiles') diff --git a/profiles/applications/sshd.py b/profiles/applications/sshd.py new file mode 100644 index 00000000..234638d5 --- /dev/null +++ b/profiles/applications/sshd.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["openssh"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('sshd') -- cgit v1.2.3-70-g09d2 From 3c5dd7b335f0618046bacc03900a4b8b354309cd Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 08:08:15 -0400 Subject: First implementation of server top-level profile --- profiles/server.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 profiles/server.py (limited to 'profiles') diff --git a/profiles/server.py b/profiles/server.py new file mode 100644 index 00000000..fcb33ee8 --- /dev/null +++ b/profiles/server.py @@ -0,0 +1,30 @@ +# Used to select various server application profiles on top of a minimal installation. + +import archinstall, os, logging + +is_top_level_profile = True + +available_servers = ["docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] + +def _prep_function(*args, **kwargs): + """ + Magic function called by the importing installer + before continuing any further. + """ + selected_servers = archinstall.generic_multi_select(available_servers, f"Choose which servers to install and enable (leave blank for a minimal installation): ") + archinstall.storage['_selected_servers'] = selected_servers + + return True # Do nothing and just return True + +if __name__ == 'server': + """ + This "profile" is a meta-profile. + """ + archinstall.log(f'Now installing the selected servers.', level=logging.INFO) + archinstall.log(archinstall.storage['_selected_servers'], level=logging.DEBUG) + for server in archinstall.storage['_selected_servers']: + archinstall.log(f'Installing {server} ...', level=logging.INFO) + app = archinstall.Application(installation, server) + app.install() + + archinstall.log('If your selections included multiple servers with the same port, you may have to reconfigure them.', fg="yellow", level=logging.INFO) -- cgit v1.2.3-70-g09d2 From 5e567b6f3b1372e97bd97b7461b39db528c5a843 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 29 Apr 2021 10:39:01 -0400 Subject: Remove a comment --- profiles/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/server.py b/profiles/server.py index fcb33ee8..fab4e7cf 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -14,7 +14,7 @@ def _prep_function(*args, **kwargs): selected_servers = archinstall.generic_multi_select(available_servers, f"Choose which servers to install and enable (leave blank for a minimal installation): ") archinstall.storage['_selected_servers'] = selected_servers - return True # Do nothing and just return True + return True if __name__ == 'server': """ -- cgit v1.2.3-70-g09d2 From 89bc10ad9a7a546b2a4dcb0cde87cc27f0005a2b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 11:11:26 -0400 Subject: Add cockpit application package --- profiles/applications/cockpit.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 profiles/applications/cockpit.py (limited to 'profiles') diff --git a/profiles/applications/cockpit.py b/profiles/applications/cockpit.py new file mode 100644 index 00000000..f1cea1d2 --- /dev/null +++ b/profiles/applications/cockpit.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["cockpit", "udisks2", "packagekit"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('cockpit.socket') -- cgit v1.2.3-70-g09d2 From af3d85dc7d2ff86531766b9b819009e0c1a659c1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 11:41:57 -0400 Subject: Add cockpit, depends on #396 --- profiles/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/server.py b/profiles/server.py index fab4e7cf..9d28054d 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -4,7 +4,7 @@ import archinstall, os, logging is_top_level_profile = True -available_servers = ["docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] +available_servers = ["cockpit", "docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-70-g09d2 From cef3a3a792a492fa91e464c8dd6d9323546e4e8d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 12:11:23 -0400 Subject: Fix i3 --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles') diff --git a/profiles/i3.py b/profiles/i3.py index 4d400468..e2db5fc7 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -60,4 +60,4 @@ if __name__ == 'i3': installation.enable_service('lightdm') # install the i3 group now - installation.add_additional_packages(installation, archinstall.storage['_i3_configuration']) \ No newline at end of file + installation.add_additional_packages(archinstall.storage['_i3_configuration']) -- cgit v1.2.3-70-g09d2