parent
ad28ae08b6
commit
81c82ef343
@ -376,14 +376,30 @@ class DMgdm(DisplayManager):
|
||||
GDM exists with different executable names, so search
|
||||
for one of them and use it.
|
||||
"""
|
||||
for executable, config in (
|
||||
candidates = (
|
||||
( "gdm", "etc/gdm/custom.conf" ),
|
||||
( "gdm3", "etc/gdm3/daemon.conf" )
|
||||
):
|
||||
( "gdm3", "etc/gdm3/daemon.conf" ),
|
||||
( "gdm3", "etc/gdm3/custom.conf" ),
|
||||
)
|
||||
|
||||
def have_executable(executable : str):
|
||||
bin_path = "{!s}/usr/bin/{!s}".format(self.root_mount_point, executable)
|
||||
sbin_path = "{!s}/usr/sbin/{!s}".format(self.root_mount_point, executable)
|
||||
if os.path.exists(bin_path) or os.path.exists(sbin_path):
|
||||
# Keep the found-executable name around for later
|
||||
return os.path.exists(bin_path) or os.path.exists(sbin_path)
|
||||
|
||||
def have_config(config : str):
|
||||
config_path = "{!s}/{!s}".format(self.root_mount_point, config)
|
||||
return os.path.exists(config_path)
|
||||
|
||||
# Look for an existing configuration file as a hint, then
|
||||
# keep the found-executable name and config around for later.
|
||||
for executable, config in candidates:
|
||||
if have_config(config) and have_executable(executable):
|
||||
self.executable = executable
|
||||
self.config = config
|
||||
return True
|
||||
for executable, config in candidates:
|
||||
if have_executable(executable):
|
||||
self.executable = executable
|
||||
self.config = config
|
||||
return True
|
||||
|
@ -4,7 +4,7 @@
|
||||
# We have tests to load (some) of the DMs specifically, to test their
|
||||
# configuration code. Those tests conventionally live in Python
|
||||
# files here in the tests/ directory. Add them.
|
||||
foreach(_dmname greetd sddm)
|
||||
foreach(_dmname greetd sddm gdm)
|
||||
add_test(
|
||||
NAME configure-displaymanager-${_dmname}
|
||||
COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-dm-${_dmname}.py
|
||||
|
19
src/modules/displaymanager/tests/test-dm-gdm.py
Normal file
19
src/modules/displaymanager/tests/test-dm-gdm.py
Normal file
@ -0,0 +1,19 @@
|
||||
# SPDX-FileCopyrightText: no
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# Calamares Boilerplate
|
||||
import libcalamares
|
||||
libcalamares.globalstorage = libcalamares.GlobalStorage(None)
|
||||
libcalamares.globalstorage.insert("testing", True)
|
||||
|
||||
# Module prep-work
|
||||
from src.modules.displaymanager import main
|
||||
default_desktop_environment = main.DesktopEnvironment("startplasma-x11", "kde-plasma.desktop")
|
||||
|
||||
# Specific DM test
|
||||
d = main.DMgdm("/tmp")
|
||||
d.have_dm()
|
||||
d.set_autologin("d", True, default_desktop_environment)
|
||||
# .. and again (this time checks load/save)
|
||||
d.set_autologin("d", True, default_desktop_environment)
|
||||
d.set_autologin("d", True, default_desktop_environment)
|
Loading…
Reference in New Issue
Block a user