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