Merge pull request #2091 from calamares/issue-2090

Allow overriding greetd user/group
This commit is contained in:
demmm 2023-02-13 11:00:11 +01:00 committed by Masato Toyoshima
commit 79d796a437
No known key found for this signature in database
GPG Key ID: 536487F1470D7187
4 changed files with 31 additions and 0 deletions

View File

@ -59,3 +59,11 @@ basicSetup: false
# *displaymanagers* list (as the only one). # *displaymanagers* list (as the only one).
# #
sysconfigSetup: false sysconfigSetup: false
# Some DMs have specific settings. These can be customized here.
#
# greetd has configurable user and group; the user and group is created if it
# does not exist, and the user is set as default-session user.
greetd:
greeter_user: "tom_bombadil"
greeter_group: "wheel"

View File

@ -20,3 +20,10 @@ properties:
required: [ executable, desktopFile ] required: [ executable, desktopFile ]
basicSetup: { type: boolean, default: false } basicSetup: { type: boolean, default: false }
sysconfigSetup: { type: boolean, default: false } sysconfigSetup: { type: boolean, default: false }
greetd:
type: object
properties:
greeter_user: { type: string }
greeter_group: { type: string }
additionalProperties: false

View File

@ -983,6 +983,11 @@ def run():
# Do the actual configuration and collect messages # Do the actual configuration and collect messages
dm_setup_message = [] dm_setup_message = []
for dm in dm_impl: for dm in dm_impl:
dm_specific_configuration = libcalamares.job.configuration.get(dm.name, None)
if dm_specific_configuration and isinstance(dm_specific_configuration, dict):
for k, v in dm_specific_configuration.items():
if hasattr(dm, k):
setattr(dm, k, v)
dm_message = None dm_message = None
if enable_basic_setup: if enable_basic_setup:
dm_message = dm.basic_setup() dm_message = dm.basic_setup()

View File

@ -307,6 +307,12 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun
mount_option) != 0: mount_option) != 0:
libcalamares.utils.warning("Cannot mount {}".format(device)) libcalamares.utils.warning("Cannot mount {}".format(device))
def enable_swap_partition(swap_partitions):
try:
for swap_device in swap_partitions:
libcalamares.utils.host_env_process_output(["swapon", swap_device])
except subprocess.CalledProcessError:
libcalamares.utils.warning("Failed to swapon " + swap_device)
def run(): def run():
""" """
@ -321,6 +327,11 @@ def run():
return (_("Configuration Error"), return (_("Configuration Error"),
_("No partitions are defined for <pre>{!s}</pre> to use.").format("mount")) _("No partitions are defined for <pre>{!s}</pre> to use.").format("mount"))
# swap
swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' and p['claimed'] == False ]
if ( swap_partitions != [] ):
enable_swap_partition(swap_partitions)
root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") root_mount_point = tempfile.mkdtemp(prefix="calamares-root-")
# Get the mountOptions, if this is None, that is OK and will be handled later # Get the mountOptions, if this is None, that is OK and will be handled later