Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/profile/profile_model.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/profile/profile_model.py')
-rw-r--r--archinstall/lib/profile/profile_model.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/archinstall/lib/profile/profile_model.py b/archinstall/lib/profile/profile_model.py
new file mode 100644
index 00000000..ad3015ae
--- /dev/null
+++ b/archinstall/lib/profile/profile_model.py
@@ -0,0 +1,35 @@
+from __future__ import annotations
+
+from dataclasses import dataclass
+from typing import TYPE_CHECKING, Any, Optional, Dict
+
+from archinstall.default_profiles.profile import Profile, GreeterType
+
+if TYPE_CHECKING:
+ _: Any
+
+
+@dataclass
+class ProfileConfiguration:
+ profile: Optional[Profile] = None
+ gfx_driver: Optional[str] = None
+ greeter: Optional[GreeterType] = None
+
+ def json(self) -> Dict[str, Any]:
+ from .profiles_handler import profile_handler
+ return {
+ 'profile': profile_handler.to_json(self.profile),
+ 'gfx_driver': self.gfx_driver,
+ 'greeter': self.greeter.value if self.greeter else None
+ }
+
+ @classmethod
+ def parse_arg(cls, arg: Dict[str, Any]) -> 'ProfileConfiguration':
+ from .profiles_handler import profile_handler
+ greeter = arg.get('greeter', None)
+
+ return ProfileConfiguration(
+ profile_handler.parse_profile_config(arg['profile']),
+ arg.get('gfx_driver', None),
+ GreeterType(greeter) if greeter else None
+ )