Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2022-01-02 16:36:50 +0100
committerAnton Hvornum <anton@hvornum.se>2022-01-02 16:38:02 +0100
commit240f688ccefa7bddb56efe5bc41a457c96792e42 (patch)
tree0f38ae348f008b08d002a5789fa48a97ed554478 /archinstall
parent93aa4aa6cc88462cf2cf4797644086e6879724bf (diff)
Adding a Pipewire application profile (#821)
* Adding a Pipewire application profile This to better manage the pipewire setup process and minimize guided a bit. This also adds the concept of @archinstall.plugin decorators to add a plugin in run-time. Which pipewire uses to detect user creation and enable the pipewire-pulse service for new users. * Forgot to run .install() on pipewire Application() * Backwards compatible variable insertion for installation session
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/__init__.py6
-rw-r--r--archinstall/lib/installer.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index 865e9844..9d7e238d 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -172,7 +172,11 @@ define_arguments()
arguments = get_arguments()
post_process_arguments(arguments)
-# TODO: Learn the dark arts of argparse... (I summon thee dark spawn of cPython)
+# @archinstall.plugin decorator hook to programmatically add
+# plugins in runtime. Useful in profiles and other things.
+def plugin(f, *args, **kwargs):
+ plugins[f.__name__] = f
+
def run_as_a_module():
"""
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 9d89c375..c02d5717 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -109,7 +109,9 @@ class Installer:
self.post_base_install = []
+ # TODO: Figure out which one of these two we'll use.. But currently we're mixing them..
storage['session'] = self
+ storage['installation_session'] = self
self.MODULES = []
self.BINARIES = []
@@ -782,13 +784,18 @@ class Installer:
handled_by_plugin = False
for plugin in plugins.values():
if hasattr(plugin, 'on_user_create'):
- if result := plugin.on_user_create(user):
+ if result := plugin.on_user_create(self, user):
handled_by_plugin = result
if not handled_by_plugin:
self.log(f'Creating user {user}', level=logging.INFO)
SysCommand(f'/usr/bin/arch-chroot {self.target} useradd -m -G wheel {user}')
+ for plugin in plugins.values():
+ if hasattr(plugin, 'on_user_created'):
+ if result := plugin.on_user_created(self, user):
+ handled_by_plugin = result
+
if password:
self.user_set_pw(user, password)