archinstall icon indicating copy to clipboard operation
archinstall copied to clipboard

Rework profile management

Open svartkanin opened this issue 3 years ago • 7 comments

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

  • Fixes https://github.com/archlinux/archinstall/issues/234
  • Fixes https://github.com/archlinux/archinstall/issues/395
  • Fixes https://github.com/archlinux/archinstall/issues/601
  • Fixes https://github.com/archlinux/archinstall/issues/606
  • Fixes https://github.com/archlinux/archinstall/issues/611
  • Fixes https://github.com/archlinux/archinstall/issues/612
  • Fixes https://github.com/archlinux/archinstall/issues/740
  • Fixes https://github.com/archlinux/archinstall/issues/999
  • Fixes https://github.com/archlinux/archinstall/issues/1154
  • Fixes https://github.com/archlinux/archinstall/issues/1175

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 avatar Aug 27 '22 09:08 svartkanin

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!

Torxed avatar Aug 28 '22 22:08 Torxed

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 avatar Aug 29 '22 01:08 svartkanin

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?

That's a good question. It would be nice if the profiles defined a meta-class or something that we can use to determinate collisions, something along the lines of what you've already got, but make a Required structure as well as IncompatibleWith value that defines what absolutely doesn't work together.

In this case I would say it would be a collision and the two desktop profiles won't work side by side.

Or we'd need to defined a Decativate function/class of profiles so that we can undo any setups done, like disabling greeters. And then the user could select one or simply, we pick a default and pre-configure that - and the user will have to do some work to get the other DE up and running? :)

Torxed avatar Aug 29 '22 11:08 Torxed

I like the idea of exclusion. Let me have a look at which profiles are absolutely incompatible, maybe we can list them separately and/or exclude them from multi select if it's only 1 or 2.

svartkanin avatar Aug 29 '22 11:08 svartkanin

The list of issues this PR would fix <3

Torxed avatar Sep 02 '22 10:09 Torxed

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

svartkanin avatar Sep 04 '22 02:09 svartkanin

I'll give it some testing during the week!

Torxed avatar Sep 04 '22 08:09 Torxed

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

svartkanin avatar Oct 01 '22 09:10 svartkanin

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 avatar Oct 03 '22 14:10 Torxed

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?

Torxed avatar Oct 03 '22 14:10 Torxed

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

svartkanin avatar Oct 03 '22 20:10 svartkanin

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

nyabinary avatar Oct 07 '22 13:10 nyabinary

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

svartkanin avatar Oct 07 '22 21:10 svartkanin

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

nyabinary avatar Oct 09 '22 18:10 nyabinary

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

svartkanin avatar Oct 09 '22 19:10 svartkanin

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

nyabinary avatar Oct 09 '22 22:10 nyabinary

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?

svartkanin avatar Oct 10 '22 01:10 svartkanin

I did! Said it was corrupted lol.

nyabinary avatar Oct 13 '22 15:10 nyabinary

Any update for merging this?

nyabinary avatar Oct 26 '22 18:10 nyabinary

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.

0xatillaa avatar Nov 18 '22 18:11 0xatillaa

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

svartkanin avatar Nov 18 '22 20:11 svartkanin

Has been merged into https://github.com/archlinux/archinstall/pull/1604 and will be added with it

svartkanin avatar Mar 13 '23 08:03 svartkanin