[displaymanager] Add support for greetd
- Includes post-PR code-fixes CLOSES #1814
This commit is contained in:
commit
2c186132cd
@ -11,6 +11,7 @@ website will have to do for older versions.
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Evan James
|
||||
- Jonas Strassel
|
||||
|
||||
## Core ##
|
||||
- The translation for Sinhala (`si`) has reached 100%. Thank you to
|
||||
@ -18,6 +19,8 @@ This release contains contributions from (alphabetically by first name):
|
||||
in completing that translation.
|
||||
|
||||
## Modules ##
|
||||
- *displaymanager* supports the *greetd* display manager, which is a
|
||||
kind of meta-DM itself, supporting multiple greeters. (Thanks Jonas)
|
||||
- *finishedq* now has an extra example QML file that builds the UI in
|
||||
a different fashion, demonstrating how a mobile-OS customization of
|
||||
Calamares would present the "all done" message.
|
||||
|
@ -23,6 +23,7 @@ displaymanagers:
|
||||
- mdm
|
||||
- lxdm
|
||||
- kdm
|
||||
- greetd
|
||||
|
||||
# Enable the following settings to force a desktop environment
|
||||
# in your displaymanager configuration file. This will attempt
|
||||
|
@ -10,7 +10,7 @@ properties:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum: [slim, sddm, lightdm, gdm, mdm, lxdm, kdm]
|
||||
enum: [slim, sddm, lightdm, gdm, mdm, lxdm, kdm, greetd]
|
||||
minItems: 1 # Must be non-empty, if present at all
|
||||
defaultDesktopEnvironment:
|
||||
type: object
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
import abc
|
||||
import os
|
||||
import re
|
||||
import libcalamares
|
||||
import configparser
|
||||
|
||||
from libcalamares.utils import gettext_path, gettext_languages
|
||||
|
||||
@ -796,6 +794,8 @@ class DMsddm(DisplayManager):
|
||||
executable = "sddm"
|
||||
|
||||
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
||||
import configparser
|
||||
|
||||
# Systems with Sddm as Desktop Manager
|
||||
sddm_conf_path = os.path.join(self.root_mount_point, "etc/sddm.conf")
|
||||
|
||||
@ -835,6 +835,90 @@ class DMsddm(DisplayManager):
|
||||
pass
|
||||
|
||||
|
||||
class DMgreetd(DisplayManager):
|
||||
name = "greetd"
|
||||
executable = "greetd"
|
||||
greeter_user = "greeter"
|
||||
greeter_group = "greetd"
|
||||
config_data = {}
|
||||
|
||||
def os_path(self, path):
|
||||
return os.path.join(self.root_mount_point, path)
|
||||
|
||||
def config_path(self):
|
||||
return self.os_path("etc/greetd/config.toml")
|
||||
|
||||
def environments_path(self):
|
||||
return self.os_path("etc/greetd/environments")
|
||||
|
||||
def config_load(self):
|
||||
import toml
|
||||
|
||||
if (os.path.exists(self.config_path())):
|
||||
with open(self.config_path(), "r") as f:
|
||||
self.config_data = toml.load(f)
|
||||
|
||||
self.config_data['terminal'] = dict(vt = "next")
|
||||
|
||||
default_session_group = self.config_data.get('default_session', None)
|
||||
if not default_session_group:
|
||||
self.config_data['default_session'] = {}
|
||||
|
||||
self.config_data['default_session']['user'] = self.greeter_user
|
||||
|
||||
return self.config_data
|
||||
|
||||
def config_write(self):
|
||||
import toml
|
||||
with open(self.config_path(), "w") as f:
|
||||
toml.dump(self.config_data, f)
|
||||
|
||||
def basic_setup(self):
|
||||
if libcalamares.utils.target_env_call(
|
||||
['getent', 'group', self.greeter_group]
|
||||
) != 0:
|
||||
libcalamares.utils.target_env_call(
|
||||
['groupadd', self.greeter_group]
|
||||
)
|
||||
|
||||
if libcalamares.utils.target_env_call(
|
||||
['getent', 'passwd', self.greeter_user]
|
||||
) != 0:
|
||||
libcalamares.utils.target_env_call(
|
||||
['useradd',
|
||||
'-c', '"Greeter User"',
|
||||
'-g', self.greeter_group,
|
||||
'-s', '/bin/bash',
|
||||
self.greeter_user
|
||||
]
|
||||
)
|
||||
|
||||
def desktop_environment_setup(self, default_desktop_environment):
|
||||
with open(self.environments_path(), 'w') as envs_file:
|
||||
envs_file.write(default_desktop_environment)
|
||||
|
||||
def greeter_setup(self):
|
||||
pass
|
||||
|
||||
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
||||
self.config_load()
|
||||
|
||||
if os.path.exists(self.os_path("usr/bin/gtkgreed")) and os.path.exists(self.os_path("usr/bin/cage")):
|
||||
self.config_data['default_session']['command'] = "cage -s -- gtkgreet"
|
||||
elif os.path.exists(self.os_path("usr/bin/tuigreet")):
|
||||
tuigreet_base_cmd = "tuigreet --remember --time --issue --asterisks --cmd "
|
||||
self.config_data['default_session']['command'] = tuigreet_base_cmd + default_desktop_environment
|
||||
elif os.path.exists(self.os_path("usr/bin/ddlm")):
|
||||
self.config_data['default_session']['command'] = "ddlm --target " + default_desktop_environment
|
||||
else:
|
||||
self.config_data['default_session']['command'] = "agreety --cmd " + default_desktop_environment
|
||||
|
||||
if do_autologin == True:
|
||||
self.config_data['initial_session'] = dict(command = default_desktop_environment, user = username)
|
||||
|
||||
self.config_write()
|
||||
|
||||
|
||||
class DMsysconfig(DisplayManager):
|
||||
name = "sysconfig"
|
||||
executable = None
|
||||
|
3
src/modules/displaymanager/tests/1.global
Normal file
3
src/modules/displaymanager/tests/1.global
Normal file
@ -0,0 +1,3 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
rootMountPoint: /
|
Loading…
Reference in New Issue
Block a user