Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework profile management #1434

Closed
wants to merge 53 commits into from

Conversation

svartkanin
Copy link
Collaborator

@svartkanin svartkanin commented Aug 27, 2022

Reworking the current profile mangement

With the current version there are some major challenges. It is tightly coupled with archinstall.storage which means that any selection in the menu will modify the storage. This makes it very difficult to reset settings and/or override them without forgetting to cleanup the ones not set.

These major changes aim to make the profile handling more flexible and dynamic and give users the ability to programmatically generate profiles. Unfortunately, this is a breaking change and the old version of profile definitions will not work anymore.

@Torxed I've transferred over all existing profiles in the repository, but I tried my best to support an automatic transfer for profiles that have been defined by users. Unfortunately, that wasn't feasible without having to cover dozens of edge cases, so this will inevitably a breaking change :(

Related issues that should be fixed with this upgrade

New features

Profiles as classes

All profiles are now defined as a class. This allows that profiles can be inherited from each other, and therefore users can build
profiles on top of other profiles. This will be essential when creating custom profiles :)

Programmatically create profiles

User will now have the ability to programmatically create profiles and inject them, as an example

class TestProfileV2(ProfileV2):
	def __init__(self):
		super().__init__('TestMe', ProfileType.CustomType)

       @property
	def packages(self) -> List[str]:
		return ['my_fav_packages']

	def install(self, install_session: 'Installer'):
		install_session.add_additional_packages(self.packages())

handler = ProfileHandler()
handler.add_custom_profile(TestProfileV2())

This also has the major benefit that no separate files have to be create anymore for profiles.

Multiple profiles per file

Currently there's a single profile definition per file. One can now create profiles programmatically as shown above, or specify them
as in the current way in a separate file.
However, now one can also specify multiple profiles per file, since the actual class definitions will be recognized as the profile.

my_profiles.py

class ProfileOne(ProfileV2):
    ...

class ProfileTwo(ProfileV2):
    ...

Ability to install multiple desktop profiles

There is now the option to install multiple desktop profiles, similar to multiple servers that already exists

Display the packages to be installed on the desktop profiles

image

Select which greeter should be installed

Each desktop profile can define a default greeter. When selecting one or multiple desktop profiles, the user will get the option
to chose which greeter should be installed with these profiles. As the default there will be a recommendation of the
default greeter (if only one or if all have the same default).

image

Create custom profiles in the menu

In the profile menu, there's also the option to create custom profiles

image

image

They will also be exported as configuration settings. If they have been created and set to disabled, and another profile (e.g. Desktop) is set then they will still be exported, this case any definitions won't be lost.

image

New option in the Menu for "Back"

In some Menus it makes sense to display a visual "Back" option. This option will behave the same way as ESC essentially does but it is more intuitive.

image

Breaking changes

  • Old profiles will not work anymore so they have to moved over to the new class format manually (all existing profiles in the repository have been moved over already)

Schema changes

The schema for the profile configuration has changed. Also the gfx driver configuration has been moved inside the profile configuration since it is never used as a standalone but only in combination with the respective profiles selected

        "profile": {
            "main":  {
                "description": "Main top level profile ",
                "type": "string",
                "enum": [
                    "desktop",
                    "minimal",
                    "server",
                    "xorg",
                ]
            },
            "details": {
                "description": "Specific profile to be installed based on the 'main' selection; these profiles are present in profiles_v2/, use the name of a profile to install it (case insensitive)",
                "type": "string",
                "enum": [
                    "awesome",
                    "bspwm",
                    "budgie",
                    "cinnamon",
                    "cutefish",
                    "deepin",
                    "desktop",
                    "enlightenment",
                    "gnome",
                    "i3-wm",
                    "i3-gasp",
                    "kde",
                    "lxqt",
                    "mate",
                    "sway",
                    "xfce4",
                    "qtile",
                    "cockpit",
                    "docker",
                    "httpd",
                    "lighttpd",
                    "mariadb",
                    "nginx",
                    "postgresql",
                    "sshd",
                    "tomcat"
                ]
            },
            "custom": {
                "description": "Specific profile definitions for custom setup profiles)",
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "packages": "string",
                        "services": "string",
                        "enabled": "boolean"
                    }
                }
            },
            "gfx_driver": {
                "description": "Graphics Drivers to install if a desktop profile is used, ignored otherwise.",
                "type": "string",
                "enum": [
                    "VMware / VirtualBox (open-source)",
                    "Intel (open-source)",
                    "AMD / ATI (open-source)",
                    "All open-source (default)",
                    "Nvidia (open kernel module for newer GPUs, Turing+)",
                    "Nvidia (open-source nouveau driver)",
                    "Nvidia (proprietary)"
                ]
            }
        },

@svartkanin svartkanin requested a review from Torxed as a code owner August 27, 2022 09:06
@Torxed
Copy link
Member

Torxed commented Aug 28, 2022

This would be huge! Just the multi-select on it's own would be awesome hehe.
I gotta test this thurrowly once I'm done releasing v2.5.1!

@svartkanin
Copy link
Collaborator Author

I'll let you know when it's ready ;)

@Torxed but as a question which I'm currently unsure about is how should we handle which greeter to install? Desktop profiles define lightdm and ssdm at the moment. Any suggestions here?

@svartkanin svartkanin changed the title [WIP] Rework profile management Rework profile management Sep 2, 2022
@svartkanin
Copy link
Collaborator Author

@Torxed I think this is ready for a review now
I have tested it to a degree but it would be better to get someone new to jump on it :)

@Torxed
Copy link
Member

Torxed commented Sep 4, 2022

I'll give it some testing during the week!

@svartkanin
Copy link
Collaborator Author

@Torxed now that the new release is out, any chance to start merging the open PRs :) ?

@Torxed
Copy link
Member

Torxed commented Oct 3, 2022

I'm full speed ahead! Feels like a classic but it's been a lot lately. But I'm in merge-mode and I'm planning on getting this in within an hour or so. Testing it now :)

@Torxed
Copy link
Member

Torxed commented Oct 3, 2022

Any reason why we removed /examples/?
I get that they moved into scripts, but the main reason for the /examples/ folder was to served as coding examples not just script entry-points. Could we move them back or would that be a horrific amount of change?

@svartkanin
Copy link
Collaborator Author

@Torxed the main reason I moved them under the scripts namespace was that they are used with the --script argument and therefore I think it makes sense having them located there.

I saw that the symlinked examples folder had to be explicitly handled for various operations (setup, pkgbuild...), and IDEs were quite confused with it (I'm entirely sure I could invest some time in setting it up properly)

I understand that they can also be seen as standalone examples, since they are essentially standalone.
I'm happy to create the examples symlink again, but as an alternative I might also suggest to maybe just refer to the scripts as the examples in the Readme or create separate explicit examples since way the scripts are setup they are not covering some actual use cases :)

@nyabinary
Copy link

Tested it, seems to not like updating the arch keyring as it spits out an error.

@svartkanin
Copy link
Collaborator Author

@VexfulNiko interesting, would you mind sharing the steps and possibly error?

@Torxed any more thoughts on this PR otherwise or can we aim to get it into the next release 😀

@nyabinary
Copy link

@svartkanin Just downloaded the Arch ISO and ran the Arch install, and it created errors saying it couldn't update the arch keyring. I tried to ping to ensure I had internet, and I did.

@svartkanin
Copy link
Collaborator Author

This PR isn't even merged so I don't think it has anything to do with the problem you encountered

@nyabinary
Copy link

An testing Archiso was created with this pr request if you go into actions

@svartkanin
Copy link
Collaborator Author

Ahh I see, regardless I don't think it has anything to do with the changes in this PR.

Have you tried running pacman -Sy archlinux-keyring?

@nyabinary
Copy link

I did! Said it was corrupted lol.

@nyabinary
Copy link

Any update for merging this?

@andrewverify
Copy link

Ahh I see, regardless I don't think it has anything to do with the changes in this PR.

Have you tried running pacman -Sy archlinux-keyring?

The latest archiso was built with this bug. For now doing rm -rf /etc/pacman.d/gnupg then pacman-keyring init pacman-keyring --populate archlinux fixes it. Also lsblk gives an error.

I am sorry but you fucked up the installer. It's not a shame to make a mistake but it's a shame to deny it. Please fix it.

@svartkanin
Copy link
Collaborator Author

@atillabirer How would this PR have "fucked up the installer" if the PR isn't even merged yet?

@svartkanin
Copy link
Collaborator Author

Has been merged into #1604 and will be added with it

@svartkanin svartkanin closed this Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment