Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-05-02 21:01:50 +1000
committerGitHub <noreply@github.com>2022-05-02 13:01:50 +0200
commitf00717ff6fd1c72d61b6928444fbf26a3f5e0e64 (patch)
tree0d37ec0b3f666d0316c7f97dce5c1cf3c81e832f /profiles
parent48b1001734529c86d09c718d28e32cd6c23958bb (diff)
Fix #1106 (#1119)
* Fix #1106 * flake8 * flake8 Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'profiles')
-rw-r--r--profiles/desktop.py37
-rw-r--r--profiles/i3.py29
-rw-r--r--profiles/server.py17
-rw-r--r--profiles/sway.py16
-rw-r--r--profiles/xorg.py8
5 files changed, 63 insertions, 44 deletions
diff --git a/profiles/desktop.py b/profiles/desktop.py
index bd3353e8..977fe2de 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -1,5 +1,6 @@
# A desktop environment selector.
import archinstall
+from archinstall import log
is_top_level_profile = True
@@ -38,29 +39,33 @@ __supported__ = [
]
-def _prep_function(*args, **kwargs):
+def _prep_function(*args, **kwargs) -> bool:
"""
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.
"""
- desktop = archinstall.Menu('Select your desired desktop environment', __supported__, skip=False).run()
+ desktop = archinstall.Menu('Select your desired desktop environment', __supported__).run()
- # Temporarily store the selected desktop profile
- # in a session-safe location, since this module will get reloaded
- # the next time it gets executed.
- if not archinstall.storage.get('_desktop_profile', None):
- archinstall.storage['_desktop_profile'] = desktop
- if not archinstall.arguments.get('desktop-environment', None):
- archinstall.arguments['desktop-environment'] = desktop
- profile = archinstall.Profile(None, desktop)
- # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
- with profile.load_instructions(namespace=f"{desktop}.py") as imported:
- if hasattr(imported, '_prep_function'):
- return imported._prep_function()
- else:
- print(f"Deprecated (??): {desktop} profile has no _prep_function() anymore")
+ if desktop:
+ # Temporarily store the selected desktop profile
+ # in a session-safe location, since this module will get reloaded
+ # the next time it gets executed.
+ if not archinstall.storage.get('_desktop_profile', None):
+ archinstall.storage['_desktop_profile'] = desktop
+ if not archinstall.arguments.get('desktop-environment', None):
+ archinstall.arguments['desktop-environment'] = desktop
+ profile = archinstall.Profile(None, desktop)
+ # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
+ with profile.load_instructions(namespace=f"{desktop}.py") as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ log(f"Deprecated (??): {desktop} profile has no _prep_function() anymore")
+ exit(1)
+
+ return False
if __name__ == 'desktop':
diff --git a/profiles/i3.py b/profiles/i3.py
index 24956209..3283848e 100644
--- a/profiles/i3.py
+++ b/profiles/i3.py
@@ -27,20 +27,21 @@ def _prep_function(*args, **kwargs):
supported_configurations = ['i3-wm', 'i3-gaps']
- desktop = archinstall.Menu('Select your desired configuration', supported_configurations, skip=False).run()
-
- # Temporarily store the selected desktop profile
- # in a session-safe location, since this module will get reloaded
- # the next time it gets executed.
- archinstall.storage['_i3_configuration'] = desktop
-
- # 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')
+ desktop = archinstall.Menu('Select your desired configuration', supported_configurations).run()
+
+ if desktop:
+ # Temporarily store the selected desktop profile
+ # in a session-safe location, since this module will get reloaded
+ # the next time it gets executed.
+ archinstall.storage['_i3_configuration'] = desktop
+
+ # 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')
if __name__ == 'i3':
diff --git a/profiles/server.py b/profiles/server.py
index c4f35f7b..bbeece12 100644
--- a/profiles/server.py
+++ b/profiles/server.py
@@ -26,15 +26,18 @@ def _prep_function(*args, **kwargs):
Magic function called by the importing installer
before continuing any further.
"""
- if not archinstall.storage.get('_selected_servers', None):
- servers = archinstall.Menu(
- 'Choose which servers to install, if none then a minimal installation wil be done', available_servers,
- multi=True
- ).run()
-
+ servers = archinstall.Menu(
+ 'Choose which servers to install, if none then a minimal installation wil be done',
+ available_servers,
+ preset_values=archinstall.storage.get('_selected_servers', []),
+ multi=True
+ ).run()
+
+ if servers:
archinstall.storage['_selected_servers'] = servers
+ return True
- return True
+ return False
if __name__ == 'server':
diff --git a/profiles/sway.py b/profiles/sway.py
index 32d626d7..e9c71b79 100644
--- a/profiles/sway.py
+++ b/profiles/sway.py
@@ -18,7 +18,9 @@ __packages__ = [
def _check_driver() -> bool:
- if "nvidia" in archinstall.storage.get("gfx_driver_packages", None):
+ packages = archinstall.storage.get("gfx_driver_packages", [])
+
+ if packages and "nvidia" in packages:
prompt = 'The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues, are you okay with that?'
choice = archinstall.Menu(prompt, ['yes', 'no'], default_option='no').run()
if choice == 'no':
@@ -34,11 +36,15 @@ 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.
"""
- archinstall.storage["gfx_driver_packages"] = archinstall.select_driver(force_ask=True)
- if not _check_driver():
- return _prep_function(args, kwargs)
+ driver = archinstall.select_driver()
- return True
+ if driver:
+ archinstall.storage["gfx_driver_packages"] = driver
+ if not _check_driver():
+ return _prep_function(args, kwargs)
+ return True
+
+ return False
# Ensures that this code only gets executed if executed
diff --git a/profiles/xorg.py b/profiles/xorg.py
index 33d2aa4c..237e4350 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -25,12 +25,16 @@ def _prep_function(*args, **kwargs):
for more input before any other installer steps start.
"""
- archinstall.storage["gfx_driver_packages"] = archinstall.select_driver()
+ driver = archinstall.select_driver()
+
+ if driver:
+ archinstall.storage["gfx_driver_packages"] = driver
+ return True
# TODO: Add language section and/or merge it with the locale selected
# earlier in for instance guided.py installer.
- return True
+ return False
# Ensures that this code only gets executed if executed