Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-10-18 10:46:28 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-10-18 10:46:28 +0200
commita60a3ca812619ace82993272233b9783cf4bc4fe (patch)
tree093609cb307be5deffdbaa46bf2d30c63d41f981 /profiles
parent60aaae4337c90bea3d485f58f7ab206cb1539a74 (diff)
Added profile `desktop.py` which helps users select a desktop environment. Also added `archinstall.generic_select` to help with selecting generic things from a list of options.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/dekstop.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/profiles/dekstop.py b/profiles/dekstop.py
new file mode 100644
index 00000000..d9e88eb1
--- /dev/null
+++ b/profiles/dekstop.py
@@ -0,0 +1,32 @@
+# A desktop environment selector.
+
+import archinstall, os
+
+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.
+ """
+
+ supported_desktops = ['gnome', 'kde', 'awesome']
+ dektop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environemtn: ')
+
+ profile = archinstall.Profile(None, dektop)
+ # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
+ with profile.load_instructions(namespace=f"{dektop}.py") as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ print(f"Deprecated (??): {dektop} profile has no _prep_function() anymore")
+
+if __name__ == 'desktop':
+ print('The desktop.py profile should never be executed as a stand-alone.')
+
+ """
+ This "profile" is a meta-profile.
+ It will not return itself, there for this __name__ will never
+ be executed. Instead, whatever profile was selected will have
+ it's handle returned and that __name__ will be executed later on.
+ """ \ No newline at end of file