Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2022-05-28 10:36:38 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2022-05-28 10:36:38 +0200
commitfaf925de1882be722d2994d697a802918282e509 (patch)
tree4856c76b10b36e94875ce3c9add961960bb23bf0 /profiles
parent3801bee921d22e23435c781c469d9ec0adfa00bd (diff)
parent78449f75bc44f0e2b03cb9d909b9b78e4f7ca4c8 (diff)
Merge branch 'upstreamMaster'
Diffstat (limited to 'profiles')
-rw-r--r--profiles/52-54-00-12-34-56.py3
-rw-r--r--profiles/awesome.py9
-rw-r--r--profiles/desktop.py50
-rw-r--r--profiles/i3.py32
-rw-r--r--profiles/minimal.py4
-rw-r--r--profiles/qtile.py1
-rw-r--r--profiles/server.py28
-rw-r--r--profiles/sway.py22
-rw-r--r--profiles/xorg.py10
9 files changed, 100 insertions, 59 deletions
diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py
index 0a1626d9..3b074629 100644
--- a/profiles/52-54-00-12-34-56.py
+++ b/profiles/52-54-00-12-34-56.py
@@ -40,7 +40,8 @@ with archinstall.Filesystem(harddrive) as fs:
installation.add_additional_packages(__packages__)
installation.install_profile('awesome')
- installation.user_create('devel', 'devel')
+ user = User('devel', 'devel', False)
+ installation.create_users(user)
installation.user_set_pw('root', 'toor')
print(f'Submitting {archinstall.__version__}: success')
diff --git a/profiles/awesome.py b/profiles/awesome.py
index 9648fc4a..11c8de3b 100644
--- a/profiles/awesome.py
+++ b/profiles/awesome.py
@@ -7,9 +7,6 @@ is_top_level_profile = False
# New way of defining packages for a profile, which is iterable and can be used out side
# of the profile to get a list of "what packages will be installed".
__packages__ = [
- "nemo",
- "gpicview",
- "maim",
"alacritty",
]
@@ -51,8 +48,4 @@ if __name__ == 'awesome':
with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'w') as fh:
fh.write(awesome_lua)
- # TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config)
-
- # Remove some interfering nemo settings
- archinstall.storage['installation_session'].arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false")
- archinstall.storage['installation_session'].arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search")
+ # TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) \ No newline at end of file
diff --git a/profiles/desktop.py b/profiles/desktop.py
index bd3353e8..e94d3505 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -1,9 +1,16 @@
# A desktop environment selector.
+from typing import Any, TYPE_CHECKING
+
import archinstall
+from archinstall import log, Menu
+from archinstall.lib.menu.menu import MenuSelectionType
+
+if TYPE_CHECKING:
+ _: Any
is_top_level_profile = True
-__description__ = 'Provides a selection of desktop environments and tiling window managers, e.g. gnome, kde, sway'
+__description__ = str(_('Provides a selection of desktop environments and tiling window managers, e.g. gnome, kde, sway'))
# New way of defining packages for a profile, which is iterable and can be used out side
# of the profile to get a list of "what packages will be installed".
@@ -38,29 +45,36 @@ __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()
-
- # 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")
+ choice = Menu(str(_('Select your desired desktop environment')), __supported__).run()
+
+ if choice.type_ != MenuSelectionType.Selection:
+ return False
+
+ if choice.value:
+ # 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'] = choice.value
+ if not archinstall.arguments.get('desktop-environment', None):
+ archinstall.arguments['desktop-environment'] = choice.value
+ profile = archinstall.Profile(None, choice.value)
+ # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
+ with profile.load_instructions(namespace=f"{choice.value}.py") as imported:
+ if hasattr(imported, '_prep_function'):
+ return imported._prep_function()
+ else:
+ log(f"Deprecated (??): {choice.value} 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..37029a02 100644
--- a/profiles/i3.py
+++ b/profiles/i3.py
@@ -1,6 +1,8 @@
# Common package for i3, lets user select which i3 configuration they want.
import archinstall
+from archinstall import Menu
+from archinstall.lib.menu.menu import MenuSelectionType
is_top_level_profile = False
@@ -27,20 +29,26 @@ def _prep_function(*args, **kwargs):
supported_configurations = ['i3-wm', 'i3-gaps']
- desktop = archinstall.Menu('Select your desired configuration', supported_configurations, skip=False).run()
+ choice = Menu('Select your desired configuration', supported_configurations).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
+ if choice.type_ != MenuSelectionType.Selection:
+ return False
- # 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 choice.value:
+ # 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'] = choice.value
+
+ # 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')
+
+ return False
if __name__ == 'i3':
diff --git a/profiles/minimal.py b/profiles/minimal.py
index c7df517c..a412aa81 100644
--- a/profiles/minimal.py
+++ b/profiles/minimal.py
@@ -1,8 +1,9 @@
# Used to do a minimal install
+import archinstall
is_top_level_profile = True
-__description__ = 'A very basic installation that allows you to customize Arch Linux as you see fit.'
+__description__ = str(_('A very basic installation that allows you to customize Arch Linux as you see fit.'))
def _prep_function(*args, **kwargs):
@@ -12,6 +13,7 @@ def _prep_function(*args, **kwargs):
we don't need to do anything special here, but it
needs to exist and return True.
"""
+ archinstall.storage['profile_minimal'] = True
return True # Do nothing and just return True
diff --git a/profiles/qtile.py b/profiles/qtile.py
index ae1409a6..ace13dcc 100644
--- a/profiles/qtile.py
+++ b/profiles/qtile.py
@@ -11,7 +11,6 @@ __packages__ = [
'alacritty',
'lightdm-gtk-greeter',
'lightdm',
- 'dmenu'
]
def _prep_function(*args, **kwargs):
diff --git a/profiles/server.py b/profiles/server.py
index c4f35f7b..21681c2f 100644
--- a/profiles/server.py
+++ b/profiles/server.py
@@ -1,12 +1,18 @@
# Used to select various server application profiles on top of a minimal installation.
import logging
+from typing import Any, TYPE_CHECKING
import archinstall
+from archinstall import Menu
+from archinstall.lib.menu.menu import MenuSelectionType
+
+if TYPE_CHECKING:
+ _: Any
is_top_level_profile = True
-__description__ = 'Provides a selection of various server packages to install and enable, e.g. httpd, nginx, mariadb'
+__description__ = str(_('Provides a selection of various server packages to install and enable, e.g. httpd, nginx, mariadb'))
available_servers = [
"cockpit",
@@ -26,15 +32,21 @@ 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()
+ choice = Menu(str(_(
+ 'Choose which servers to install, if none then a minimal installation wil be done')),
+ available_servers,
+ preset_values=kwargs['servers'],
+ multi=True
+ ).run()
+
+ if choice.type_ != MenuSelectionType.Selection:
+ return False
- archinstall.storage['_selected_servers'] = servers
+ if choice.value:
+ archinstall.storage['_selected_servers'] = choice.value
+ return True
- return True
+ return False
if __name__ == 'server':
diff --git a/profiles/sway.py b/profiles/sway.py
index 32d626d7..b7266da3 100644
--- a/profiles/sway.py
+++ b/profiles/sway.py
@@ -1,5 +1,6 @@
# A desktop environment using "Sway"
import archinstall
+from archinstall import Menu
is_top_level_profile = False
@@ -18,10 +19,13 @@ __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':
+ choice = Menu(prompt, Menu.yes_no(), default_option=Menu.no(), skip=False).run()
+
+ if choice.value == Menu.no():
return False
return True
@@ -34,11 +38,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..2ce8dcc2 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -6,7 +6,7 @@ from archinstall.lib.hardware import __packages__ as __hwd__packages__
is_top_level_profile = True
-__description__ = 'Installs a minimal system as well as xorg and graphics drivers.'
+__description__ = str(_('Installs a minimal system as well as xorg and graphics drivers.'))
__packages__ = [
'dkms',
@@ -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