Move seat access provisioning into DesktopProfile.provision()
The four Wayland profiles (Hyprland, Sway, niri, labwc) each duplicated a provision() override calling provision_seat_access(). Move that into the base DesktopProfile.provision() loop, which already iterates the selected profiles, and read CustomSetting.SeatAccess from each. The None check now lives at the call site (walrus), so provision_seat_access() takes a plain str. This removes the per-profile overrides and their TYPE_CHECKING imports.
This commit is contained in:
parent
a31fd72f1e
commit
2d175312d9
|
|
@ -1,6 +1,7 @@
|
|||
from typing import TYPE_CHECKING, Self, override
|
||||
|
||||
from archinstall.default_profiles.profile import DisplayServerType, GreeterType, Profile, ProfileType, SelectResult
|
||||
from archinstall.default_profiles.desktops.utils import provision_seat_access
|
||||
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType, SelectResult
|
||||
from archinstall.lib.log import info
|
||||
from archinstall.lib.menu.helpers import Selection
|
||||
from archinstall.lib.profile.profiles_handler import profile_handler
|
||||
|
|
@ -94,6 +95,9 @@ class DesktopProfile(Profile):
|
|||
for profile in self.current_selection:
|
||||
profile.provision(install_session, users)
|
||||
|
||||
if seat_access := profile.custom_settings.get(CustomSetting.SeatAccess):
|
||||
provision_seat_access(install_session, users, seat_access)
|
||||
|
||||
@override
|
||||
def install(self, install_session: Installer) -> None:
|
||||
# Install common packages for all desktop environments
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
from typing import TYPE_CHECKING, override
|
||||
from typing import override
|
||||
|
||||
from archinstall.default_profiles.desktops.utils import provision_seat_access, select_seat_access
|
||||
from archinstall.default_profiles.desktops.utils import select_seat_access
|
||||
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from archinstall.lib.installer import Installer
|
||||
from archinstall.lib.models.users import User
|
||||
|
||||
|
||||
class HyprlandProfile(Profile):
|
||||
def __init__(self) -> None:
|
||||
|
|
@ -49,10 +45,6 @@ class HyprlandProfile(Profile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
@override
|
||||
def provision(self, install_session: Installer, users: list[User]) -> None:
|
||||
provision_seat_access(install_session, users, self.custom_settings.get(CustomSetting.SeatAccess))
|
||||
|
||||
@override
|
||||
async def do_on_select(self) -> None:
|
||||
default = self.custom_settings.get(CustomSetting.SeatAccess, None)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
from typing import TYPE_CHECKING, override
|
||||
from typing import override
|
||||
|
||||
from archinstall.default_profiles.desktops.utils import provision_seat_access, select_seat_access
|
||||
from archinstall.default_profiles.desktops.utils import select_seat_access
|
||||
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from archinstall.lib.installer import Installer
|
||||
from archinstall.lib.models.users import User
|
||||
|
||||
|
||||
class LabwcProfile(Profile):
|
||||
def __init__(self) -> None:
|
||||
|
|
@ -43,10 +39,6 @@ class LabwcProfile(Profile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
@override
|
||||
def provision(self, install_session: Installer, users: list[User]) -> None:
|
||||
provision_seat_access(install_session, users, self.custom_settings.get(CustomSetting.SeatAccess))
|
||||
|
||||
@override
|
||||
async def do_on_select(self) -> None:
|
||||
default = self.custom_settings.get(CustomSetting.SeatAccess, None)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
from typing import TYPE_CHECKING, override
|
||||
from typing import override
|
||||
|
||||
from archinstall.default_profiles.desktops.utils import provision_seat_access, select_seat_access
|
||||
from archinstall.default_profiles.desktops.utils import select_seat_access
|
||||
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from archinstall.lib.installer import Installer
|
||||
from archinstall.lib.models.users import User
|
||||
|
||||
|
||||
class NiriProfile(Profile):
|
||||
def __init__(self) -> None:
|
||||
|
|
@ -51,10 +47,6 @@ class NiriProfile(Profile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
@override
|
||||
def provision(self, install_session: Installer, users: list[User]) -> None:
|
||||
provision_seat_access(install_session, users, self.custom_settings.get(CustomSetting.SeatAccess))
|
||||
|
||||
@override
|
||||
async def do_on_select(self) -> None:
|
||||
default = self.custom_settings.get(CustomSetting.SeatAccess, None)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
from typing import TYPE_CHECKING, override
|
||||
from typing import override
|
||||
|
||||
from archinstall.default_profiles.desktops.utils import provision_seat_access, select_seat_access
|
||||
from archinstall.default_profiles.desktops.utils import select_seat_access
|
||||
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from archinstall.lib.installer import Installer
|
||||
from archinstall.lib.models.users import User
|
||||
|
||||
|
||||
class SwayProfile(Profile):
|
||||
def __init__(self) -> None:
|
||||
|
|
@ -53,10 +49,6 @@ class SwayProfile(Profile):
|
|||
return [pref]
|
||||
return []
|
||||
|
||||
@override
|
||||
def provision(self, install_session: Installer, users: list[User]) -> None:
|
||||
provision_seat_access(install_session, users, self.custom_settings.get(CustomSetting.SeatAccess))
|
||||
|
||||
@override
|
||||
async def do_on_select(self) -> None:
|
||||
default = self.custom_settings.get(CustomSetting.SeatAccess, None)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class SeatAccess(Enum):
|
|||
def provision_seat_access(
|
||||
install_session: Installer,
|
||||
users: list[User],
|
||||
seat_access: str | None,
|
||||
seat_access: str,
|
||||
) -> None:
|
||||
if seat_access == SeatAccess.seatd.value:
|
||||
for user in users:
|
||||
|
|
|
|||
Loading…
Reference in New Issue