File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 33from enum import Enum , auto
44from typing import TYPE_CHECKING , Self
55
6+ from archinstall .lib .models .users import User
67from archinstall .lib .translationhandler import tr
78
89if TYPE_CHECKING :
@@ -103,6 +104,13 @@ def post_install(self, install_session: Installer) -> None:
103104 are needed
104105 """
105106
107+ def provision (self , install_session : Installer , users : list [User ]) -> None :
108+ """
109+ Hook that will be called when the installation process is
110+ finished and user configuration for specific default_profiles
111+ is needed
112+ """
113+
106114 def json (self ) -> dict [str , str ]:
107115 """
108116 Returns a json representation of the profile
Original file line number Diff line number Diff line change 44
55from archinstall .default_profiles .profile import Profile , ProfileType , SelectResult
66from archinstall .lib .menu .helpers import Selection
7+ from archinstall .lib .models .users import User
78from archinstall .lib .output import info
89from archinstall .lib .profile .profiles_handler import profile_handler
910from archinstall .tui .ui .menu_item import MenuItem , MenuItemGroup
@@ -53,6 +54,11 @@ def do_on_select(self) -> SelectResult:
5354 case ResultType .Reset :
5455 return SelectResult .ResetCurrent
5556
57+ @override
58+ def provision (self , install_session : Installer , users : list [User ]) -> None :
59+ for profile in self .current_selection :
60+ profile .provision (install_session , users )
61+
5662 @override
5763 def post_install (self , install_session : Installer ) -> None :
5864 for profile in self .current_selection :
Original file line number Diff line number Diff line change 33from typing import TYPE_CHECKING , override
44
55from archinstall .default_profiles .profile import Profile , ProfileType
6+ from archinstall .lib .models .users import User
67
78if TYPE_CHECKING :
89 from archinstall .lib .installer import Installer
@@ -26,9 +27,6 @@ def services(self) -> list[str]:
2627 return ['docker' ]
2728
2829 @override
29- def post_install (self , install_session : Installer ) -> None :
30- from archinstall .lib .args import arch_config_handler
31-
32- if auth_config := arch_config_handler .config .auth_config :
33- for user in auth_config .users :
34- install_session .arch_chroot (f'usermod -a -G docker { user .username } ' )
30+ def provision (self , install_session : Installer , users : list [User ]) -> None :
31+ for user in users :
32+ install_session .arch_chroot (f'usermod -a -G docker { user .username } ' )
Original file line number Diff line number Diff line change @@ -123,8 +123,10 @@ def perform_installation(
123123 config .profile_config ,
124124 )
125125
126+ users = None
126127 if config .auth_config :
127128 if config .auth_config .users :
129+ users = config .auth_config .users
128130 installation .create_users (config .auth_config .users )
129131 auth_handler .setup_auth (installation , config .auth_config , config .hostname )
130132
@@ -153,6 +155,9 @@ def perform_installation(
153155 if (profile_config := config .profile_config ) and profile_config .profile :
154156 profile_config .profile .post_install (installation )
155157
158+ if users :
159+ profile_config .profile .provision (installation , users )
160+
156161 # If the user provided a list of services to be enabled, pass the list to the enable_service function.
157162 # Note that while it's called enable_service, it can actually take a list of services and iterate it.
158163 if services := config .services :
You can’t perform that action at this time.
0 commit comments