trigger service

This commit is contained in:
2025-12-22 22:49:51 +08:00
parent 5aa4dfd679
commit 05b1f34bae
25 changed files with 2497 additions and 0 deletions

15
sddm/00-general.conf Normal file
View File

@@ -0,0 +1,15 @@
[XDisplay]
ServerPath=/usr/bin/X
SessionCommand=/usr/etc/X11/xdm/Xsession
DisplayCommand=/usr/etc/X11/xdm/Xsetup
# No effect in 0.20.0, might change in the future again
MinimumVT=7
# boo#1089932
EnableHiDPI=true
[Users]
# boo#979775
ReuseSession=true
[Autologin]
Session=default.desktop

View File

@@ -0,0 +1,25 @@
From f40c3840253be415a58484cc59459cb433be3220 Mon Sep 17 00:00:00 2001
From: Heiko Becker <heiko.becker@kde.org>
Date: Sun, 23 Feb 2025 22:21:25 +0100
Subject: [PATCH] CMake: Raise required version to 3.5
CMake >= 4.0.0-rc1 removed compatibility with versions < 3.5 and errors
out with such versions passed to cmake_minimum_required(). 3.5.0 has
been released 9 years ago, so I'd assume it's available almost everywhere.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b8a147..07442d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.4)
+cmake_minimum_required(VERSION 3.5)
project(SDDM)
--
2.49.0

View File

@@ -0,0 +1,28 @@
From d021e6d191a388b0dae8b1e0eea675423b86099d Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sun, 17 Mar 2024 19:00:20 +0100
Subject: [PATCH] Fix terminal clearing
sizeof(char *) wasn't the intention there.
---
src/common/VirtualTerminal.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/VirtualTerminal.cpp b/src/common/VirtualTerminal.cpp
index 9c0261e..020405a 100644
--- a/src/common/VirtualTerminal.cpp
+++ b/src/common/VirtualTerminal.cpp
@@ -209,8 +209,8 @@ out:
fd = vtFd;
// Clear VT
- static const char *clearEscapeSequence = "\33[H\33[2J";
- if (write(vtFd, clearEscapeSequence, sizeof(clearEscapeSequence)) == -1) {
+ static const char clearEscapeSequence[] = "\33[H\33[2J";
+ if (write(vtFd, clearEscapeSequence, sizeof(clearEscapeSequence) - 1) == -1) {
qWarning("Failed to clear VT %d: %s", vt, strerror(errno));
}
--
2.44.0

View File

@@ -0,0 +1,78 @@
From 5cc1a99fadce25298124cde0be8be9bab25c87cc Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Sat, 2 Sep 2017 11:27:01 +0200
Subject: [PATCH] Read the DISPLAYMANAGER_AUTOLOGIN value from
sysconfig/displaymanager
Support DISPLAYMANAGER_AUTOLOGIN entry from /etc/sysconfig/displaymanager,
the value overwrites any entry in sddm.conf/[Autologin]/User.
Patch also defaults to default.desktop as default autologin session.
This is controlled only by sddm.conf file.
---
CMakeLists.txt | 1 +
src/common/Configuration.h | 5 +++--
src/common/Constants.h.in | 1 +
src/daemon/Display.cpp | 6 ++++++
4 files changed, 11 insertions(+), 2 deletions(-)
Index: sddm-0.21.0/CMakeLists.txt
===================================================================
--- sddm-0.21.0.orig/CMakeLists.txt
+++ sddm-0.21.0/CMakeLists.txt
@@ -184,6 +184,7 @@ set(CONFIG_FILE "${CMAKE
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sddm.conf.d" CACHE PATH "Path of the sddm config directory")
set(ACCOUNTSSERVICE_DATA_DIR "/var/lib/AccountsService" CACHE PATH "Path of the accountsservice data directory")
set(SYSTEM_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/sddm/sddm.conf.d" CACHE PATH "Path of the system sddm config directory")
+set(DISPLAY_MANAGER_CONFIG_FILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sysconfig/displaymanager" CACHE PATH "Path of the sysconfig/displaymanager config file")
set(LOG_FILE "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/sddm.log" CACHE PATH "Path of the sddm log file")
set(DBUS_CONFIG_FILENAME "org.freedesktop.DisplayManager.conf" CACHE STRING "Name of the sddm config file")
set(COMPONENTS_TRANSLATION_DIR "${DATA_INSTALL_DIR}/translations-qt${QT_MAJOR_VERSION}" CACHE PATH "Components translations directory")
Index: sddm-0.21.0/src/common/Configuration.h
===================================================================
--- sddm-0.21.0.orig/src/common/Configuration.h
+++ sddm-0.21.0/src/common/Configuration.h
@@ -108,7 +108,7 @@ namespace SDDM {
Config(StateConfig, []()->QString{auto tmp = getpwnam("sddm"); return tmp ? QString::fromLocal8Bit(tmp->pw_dir) : QStringLiteral(STATE_DIR);}().append(QStringLiteral("/state.conf")), QString(), QString(),
Section(Last,
- Entry(Session, QString, QString(), _S("Name of the session for the last logged-in user.\n"
+ Entry(Session, QString, _S("/usr/share/xsessions/default.desktop"), _S("Name of the session for the last logged-in user.\n"
"This session will be preselected when the login screen appears."));
Entry(User, QString, QString(), _S("Name of the last logged-in user.\n"
"This user will be preselected when the login screen appears"));
Index: sddm-0.21.0/src/common/Constants.h.in
===================================================================
--- sddm-0.21.0.orig/src/common/Constants.h.in
+++ sddm-0.21.0/src/common/Constants.h.in
@@ -36,6 +36,7 @@
#define CONFIG_FILE "@CONFIG_FILE@"
#define CONFIG_DIR "@CONFIG_DIR@"
#define SYSTEM_CONFIG_DIR "@SYSTEM_CONFIG_DIR@"
+#define DISPLAY_MANAGER_CONFIG_FILE "@DISPLAY_MANAGER_CONFIG_FILE@"
#define LOG_FILE "@LOG_FILE@"
#define PID_FILE "@PID_FILE@"
Index: sddm-0.21.0/src/daemon/Display.cpp
===================================================================
--- sddm-0.21.0.orig/src/daemon/Display.cpp
+++ sddm-0.21.0/src/daemon/Display.cpp
@@ -35,6 +35,7 @@
#include <QFile>
#include <QTimer>
#include <QLocalSocket>
+#include <QSettings>
#include <pwd.h>
#include <unistd.h>
@@ -166,6 +167,11 @@ namespace SDDM {
});
connect(m_greeter, &Greeter::displayServerFailed, this, &Display::displayServerFailed);
+ QSettings sysconfSettings(QStringLiteral(DISPLAY_MANAGER_CONFIG_FILE), QSettings::NativeFormat);
+ QString sysconfigUser = sysconfSettings.value(QStringLiteral("DISPLAYMANAGER_AUTOLOGIN"), QStringLiteral("")).toString();
+
+ mainConfig.Autologin.User.set(sysconfigUser);
+
// Load autologin configuration (whether to autologin, user, session, session type)
if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
!mainConfig.Autologin.User.get().isEmpty()) {

View File

@@ -0,0 +1,168 @@
From 505e5c6665e68fac58d9f6c689cc0c1bea2a83bc Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Fri, 4 Aug 2023 23:34:08 +0200
Subject: [PATCH] Redesign login shell use in session scripts
Avoid the re-import of variables into sh by using the user's login shell
to invoke the session.
For the wayland-session script it's straightforward: Just exec the session
command directly within the login shell.
For the Xsession script it's a bit more complex: The login shell environment
has to be loaded first, then the xprofile files, so that they can overwrite
the login shell environment. To achieve this, the script runs in two stages:
The first uses the login shell to exec the second stage, which then reads
xprofile and execs the session.
---
data/scripts/Xsession | 69 ++++++++++++++++++------------------
data/scripts/wayland-session | 35 +++++-------------
2 files changed, 43 insertions(+), 61 deletions(-)
diff --git a/data/scripts/Xsession b/data/scripts/Xsession
index a971d40..235a671 100755
--- a/data/scripts/Xsession
+++ b/data/scripts/Xsession
@@ -5,39 +5,34 @@
# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>
-# Note that the respective logout scripts are not sourced.
-case $SHELL in
- */bash)
- [ -z "$BASH" ] && exec $SHELL --login $0 "$@"
- shopt -q login_shell || exec $SHELL --login $0 "$@"
- set +o posix
- ;;
- */zsh)
- [ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@"
- [[ -o login ]] || exec $SHELL --login $0 "$@"
- emulate -R sh
- ;;
- */csh|*/tcsh)
- # [t]cshrc is always sourced automatically.
- # Note that sourcing csh.login after .cshrc is non-standard.
- xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
- $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $xsess_tmp"
- . $xsess_tmp
- rm -f $xsess_tmp
- ;;
- */fish)
- [ -f /etc/profile ] && . /etc/profile
- [ -f $HOME/.profile ] && . $HOME/.profile
- xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
- $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
- . $xsess_tmp
- rm -f $xsess_tmp
- ;;
- *) # Plain sh, ksh, and anything we do not know.
- [ -f /etc/profile ] && . /etc/profile
- [ -f $HOME/.profile ] && . $HOME/.profile
- ;;
-esac
+# Import the login environment for some shells by starting them as login shell
+# and executing this script. Inside, SDDM_XSESSION_PROFILE_READ will be set and
+# it continues below.
+if [ -z "$SDDM_XSESSION_PROFILE_READ" ]; then
+ export SDDM_XSESSION_PROFILE_READ=1
+
+ case $SHELL in
+ */bash|*/zsh)
+ exec $SHELL --login -c 'exec "$@"' - $0 "$@"
+ ;;
+ */csh|*/tcsh)
+ exec $SHELL -c 'if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; exec $argv' $0 "$@"
+ ;;
+ */fish)
+ [ -f /etc/profile ] && . /etc/profile
+ [ -f $HOME/.profile ] && . $HOME/.profile
+ exec $SHELL --login -c 'exec $argv' $0 "$@"
+ ;;
+ *) # Plain sh, ksh, and anything we do not know.
+ [ -f /etc/profile ] && . /etc/profile
+ [ -f $HOME/.profile ] && . $HOME/.profile
+ exec $0 "$@"
+ ;;
+ esac
+
+ exit 1
+fi
+unset SDDM_XSESSION_PROFILE_READ
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile
@@ -89,6 +84,10 @@ fi
if [ -z "$*" ]; then
exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session."
-else
- exec $@
+ exit 1
fi
+
+# Note: This script is called with the whole session commandline as a single first argument.
+# To run it properly, word splitting has to be performed by the shell, i.e. $@ or $0 without quotes.
+exec $@
+exit 1
diff --git a/data/scripts/wayland-session b/data/scripts/wayland-session
index bbeb7ce..3ed44b0 100755
--- a/data/scripts/wayland-session
+++ b/data/scripts/wayland-session
@@ -5,45 +5,28 @@
# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>
-# Note that the respective logout scripts are not sourced.
+# Note: This script is called with the whole session commandline as a single first argument.
+# To run it properly, word splitting has to be performed by the shell, i.e. $@ or $0 without quotes.
-# Backup the user shell setting into SDDM specific variable
-SDDM_USER_SHELL=$SHELL
+# Note that the respective logout scripts are not sourced.
case $SHELL in
- */bash)
- [ -z "$BASH" ] && exec $SHELL --login $0 "$@"
- shopt -q login_shell || exec $SHELL --login $0 "$@"
- set +o posix
- ;;
- */zsh)
- [ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@"
- [[ -o login ]] || exec $SHELL --login $0 "$@"
- emulate -R sh
+ */bash|*/zsh)
+ exec $SHELL --login -c 'exec "$@"' - $@
;;
*/csh|*/tcsh)
- # [t]cshrc is always sourced automatically.
- # Note that sourcing csh.login after .cshrc is non-standard.
- wlsess_tmp=`mktemp /tmp/wlsess-env-XXXXXX`
- $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $wlsess_tmp"
- . $wlsess_tmp
- rm -f $wlsess_tmp
+ exec $SHELL -c 'if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; exec $argv' $@
;;
*/fish)
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
- xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
- $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
- . $xsess_tmp
- rm -f $xsess_tmp
+ exec $SHELL --login -c 'exec $argv' $@
;;
*) # Plain sh, ksh, and anything we do not know.
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
+ exec $@
;;
esac
-# Restore user shell setting that may have been clobbered by setting environment
-export SHELL=$SDDM_USER_SHELL
-
-exec $@
+exit 1
--
2.44.0

View File

@@ -0,0 +1,21 @@
From 821e0fd9c9d18b7025c2c79981382fa7321ca690 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 15 Jul 2024 20:47:26 +0200
Subject: [PATCH 1/5] Remove unused Display::m_relogin variable
---
src/daemon/Display.h | 1 -
1 file changed, 1 deletion(-)
Index: sddm-0.21.0/src/daemon/Display.h
===================================================================
--- sddm-0.21.0.orig/src/daemon/Display.h
+++ sddm-0.21.0/src/daemon/Display.h
@@ -94,7 +94,6 @@ namespace SDDM {
DisplayServerType m_displayServerType = X11DisplayServerType;
- bool m_relogin { true };
bool m_started { false };
int m_terminalId = 0;

View File

@@ -0,0 +1,39 @@
From 39d30f19ac7948eb5e9ab2ef0f219ae770644f55 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 24 Oct 2020 13:57:05 +0200
Subject: [PATCH] Set XAUTHLOCALHOSTNAME in sessions
While FamilyWild avoids that hostname changes break xauth, this doesn't help
with Xtrans (used for ICE). Xtrans always uses the current host name for
setting $SESSION_MANAGER and for a successful connection this has to match
the current hostname (or $XAUTHLOCALHOSTNAME, see p_xauth.diff in xtrans)
on client connection attempts as well. By setting XAUTHLOCALHOSTNAME here,
it's likely that it equals the hostname set by the session manager later
(e.g. ksmserver).
---
src/helper/Backend.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/helper/Backend.cpp b/src/helper/Backend.cpp
index 91ca211..1b0bb6f 100644
--- a/src/helper/Backend.cpp
+++ b/src/helper/Backend.cpp
@@ -27,6 +27,7 @@
#include "UserSession.h"
#include <QtCore/QProcessEnvironment>
+#include <QtNetwork/QHostInfo>
#include <pwd.h>
@@ -73,6 +74,7 @@ namespace SDDM {
env.insert(QStringLiteral("SHELL"), QString::fromLocal8Bit(pw->pw_shell));
env.insert(QStringLiteral("USER"), QString::fromLocal8Bit(pw->pw_name));
env.insert(QStringLiteral("LOGNAME"), QString::fromLocal8Bit(pw->pw_name));
+ env.insert(QStringLiteral("XAUTHLOCALHOSTNAME"), QHostInfo::localHostName());
#if defined(Q_OS_FREEBSD)
/* get additional environment variables via setclassenvironment();
this needs to be done here instead of in UserSession::setupChildProcess
--
2.39.1

View File

@@ -0,0 +1,90 @@
From 1e8920dc85f9c80950c41ecb9923024264cc243d Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 4 Apr 2024 21:47:23 +0200
Subject: [PATCH] Use xrdb to set Xcursor.theme
XCURSOR_THEME is no longer enough.
---
src/daemon/XorgDisplayServer.cpp | 17 +++++++++++++++--
src/helper/xorguserhelper.cpp | 13 +++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
index 5101cfb..2249ac2 100644
--- a/src/daemon/XorgDisplayServer.cpp
+++ b/src/daemon/XorgDisplayServer.cpp
@@ -261,6 +261,9 @@ namespace SDDM {
// create display setup script process
QProcess *displayScript = new QProcess();
+ const QString xcursorTheme = mainConfig.Theme.CursorTheme.get(),
+ xcursorSize = mainConfig.Theme.CursorSize.get();
+
// set process environment
QProcessEnvironment env;
env.insert(QStringLiteral("DISPLAY"), m_display);
@@ -268,8 +271,8 @@ namespace SDDM {
env.insert(QStringLiteral("PATH"), mainConfig.Users.DefaultPath.get());
env.insert(QStringLiteral("XAUTHORITY"), m_xauth.authPath());
env.insert(QStringLiteral("SHELL"), QStringLiteral("/bin/sh"));
- env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get());
- QString xcursorSize = mainConfig.Theme.CursorSize.get();
+ if (!xcursorTheme.isEmpty())
+ env.insert(QStringLiteral("XCURSOR_THEME"), xcursorTheme);
if (!xcursorSize.isEmpty())
env.insert(QStringLiteral("XCURSOR_SIZE"), xcursorSize);
setCursor->setProcessEnvironment(env);
@@ -287,6 +290,16 @@ namespace SDDM {
setCursor->kill();
}
+ // Unlike libXcursor, xcb-util-cursor no longer looks at XCURSOR_THEME. Set the resource.
+ if (!xcursorTheme.isEmpty()) {
+ QProcess xrdbProcess;
+ xrdbProcess.setProcessEnvironment(env);
+ xrdbProcess.start(QStringLiteral("xrdb"), QStringList{QStringLiteral("-nocpp"), QStringLiteral("-merge")});
+ xrdbProcess.write(QStringLiteral("Xcursor.theme: %1").arg(xcursorTheme).toUtf8());
+ xrdbProcess.closeWriteChannel();
+ xrdbProcess.waitForFinished(1000);
+ }
+
// start display setup script
qDebug() << "Running display setup script " << mainConfig.X11.DisplayCommand.get();
QStringList displayCommand = QProcess::splitCommand(mainConfig.X11.DisplayCommand.get());
diff --git a/src/helper/xorguserhelper.cpp b/src/helper/xorguserhelper.cpp
index 3f564a2..1d8213e 100644
--- a/src/helper/xorguserhelper.cpp
+++ b/src/helper/xorguserhelper.cpp
@@ -200,9 +200,12 @@ bool XOrgUserHelper::startServer(const QString &cmd)
void XOrgUserHelper::startDisplayCommand()
{
+ const QString xcursorTheme = mainConfig.Theme.CursorTheme.get();
+
auto env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("DISPLAY"), m_display);
env.insert(QStringLiteral("XAUTHORITY"), m_xauth.authPath());
+ env.insert(QStringLiteral("XCURSOR_THEME"), xcursorTheme);
// Set cursor
qInfo("Setting default cursor...");
@@ -215,6 +218,16 @@ void XOrgUserHelper::startDisplayCommand()
setCursor->deleteLater();
}
+ // Unlike libXcursor, xcb-util-cursor no longer looks at XCURSOR_THEME. Set the resource.
+ if (!xcursorTheme.isEmpty()) {
+ QProcess xrdbProcess;
+ xrdbProcess.setProcessEnvironment(env);
+ xrdbProcess.start(QStringLiteral("xrdb"), QStringList{QStringLiteral("-nocpp"), QStringLiteral("-merge")});
+ xrdbProcess.write(QStringLiteral("Xcursor.theme: %1").arg(xcursorTheme).toUtf8());
+ xrdbProcess.closeWriteChannel();
+ xrdbProcess.waitForFinished(1000);
+ }
+
// Display setup script
auto cmd = mainConfig.X11.DisplayCommand.get();
qInfo("Running display setup script: %s", qPrintable(cmd));
--
2.44.0

View File

@@ -0,0 +1,56 @@
From 646b025efada0b9bb1b3680d2a8e264b28cdb820 Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Sat, 2 Sep 2017 11:09:51 +0200
Subject: [PATCH] Write the daemon's PID to a file on startup
openSUSE's generic display-manager service doesn't know what to do
without a pid file. drop the patch as soon as that sick dinosaur is killed.
---
src/common/Constants.h.in | 1 +
src/daemon/DaemonApp.cpp | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in
index 405da5e..7b2669e 100644
--- a/src/common/Constants.h.in
+++ b/src/common/Constants.h.in
@@ -38,6 +38,7 @@
#define SYSTEM_CONFIG_DIR "@SYSTEM_CONFIG_DIR@"
#define LOG_FILE "@LOG_FILE@"
+#define PID_FILE "@PID_FILE@"
#define UID_MIN @UID_MIN@
#define UID_MAX @UID_MAX@
diff --git a/src/daemon/DaemonApp.cpp b/src/daemon/DaemonApp.cpp
index 490068e..2b6777a 100644
--- a/src/daemon/DaemonApp.cpp
+++ b/src/daemon/DaemonApp.cpp
@@ -32,6 +32,7 @@
#include <QDebug>
#include <QHostInfo>
#include <QTimer>
+#include <QFile>
#include <iostream>
@@ -47,6 +48,16 @@ namespace SDDM {
// log message
qDebug() << "Initializing...";
+ // Write PID File
+ if ( ! QString(QStringLiteral(PID_FILE)).isEmpty() ) {
+ QFile pidFile(QStringLiteral(PID_FILE));
+ QString pid = QString::number(QCoreApplication::applicationPid());
+ if ( pidFile.open(QIODevice::WriteOnly | QIODevice::Text) ) {
+ pidFile.write(pid.toLatin1().data(), qstrlen(pid.toLatin1().data()));
+ pidFile.close();
+ }
+ }
+
// set testing parameter
m_testing = (arguments().indexOf(QStringLiteral("--test-mode")) != -1);
--
2.41.0

View File

@@ -0,0 +1,71 @@
From 1e56412d495b13b469f9a73efdc99701d48b831e Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 15 Jul 2024 21:10:12 +0200
Subject: [PATCH 2/5] Set Display::m_started early
It's only read to check whether start() and stop() should do anything,
so set it true as soon as it attempted to start anything.
---
src/daemon/Display.cpp | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 1a0a369..91e4dac 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -205,7 +205,12 @@ namespace SDDM {
}
bool Display::start() {
- return m_started || m_displayServer->start();
+ if (m_started)
+ return true;
+
+ m_started = true;
+
+ return m_displayServer->start();
}
bool Display::attemptAutologin() {
@@ -256,9 +261,6 @@ namespace SDDM {
// reset first flag
daemonApp->first = false;
-
- // set flags
- m_started = true;
}
void Display::handleAutologinFailure() {
@@ -268,10 +270,6 @@ namespace SDDM {
}
void Display::displayServerStarted() {
- // check flag
- if (m_started)
- return;
-
// setup display
m_displayServer->setupDisplay();
@@ -283,9 +281,6 @@ namespace SDDM {
// reset first flag
daemonApp->first = false;
- // set flags
- m_started = true;
-
const bool autologinStarted = attemptAutologin();
if (!autologinStarted)
handleAutologinFailure();
@@ -484,7 +479,6 @@ namespace SDDM {
OrgFreedesktopLogin1ManagerInterface manager(Logind::serviceName(), Logind::managerPath(), QDBusConnection::systemBus());
manager.UnlockSession(m_reuseSessionId);
manager.ActivateSession(m_reuseSessionId);
- m_started = true;
} else {
if (qobject_cast<XorgDisplayServer *>(m_displayServer))
m_auth->setCookie(qobject_cast<XorgDisplayServer *>(m_displayServer)->cookie());
--
2.46.0

View File

@@ -0,0 +1,45 @@
From a86829ae62b4338be716b3d75642321e631dcdec Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 4 Feb 2023 22:14:16 +0100
Subject: [PATCH] Leave duplicate symlinks out of the SessionModel
Used for autologin (default.desktop) and backwards-compat.
---
src/greeter/SessionModel.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
index 3a89d42..9eaab10 100644
--- a/src/greeter/SessionModel.cpp
+++ b/src/greeter/SessionModel.cpp
@@ -136,6 +136,15 @@ namespace SDDM {
sessions.removeDuplicates();
for (auto& session : qAsConst(sessions)) {
Session *si = new Session(type, session);
+
+ // Skip symlinks that point to the same directory,
+ // they will be visited under the real name
+ QFileInfo fi_link(si->fileName());
+ if (fi_link.isSymLink() && fi_link.canonicalPath() == si->directory().path()) {
+ delete si;
+ continue;
+ }
+
bool execAllowed = true;
QFileInfo fi(si->tryExec());
if (fi.isAbsolute()) {
@@ -164,8 +173,10 @@ namespace SDDM {
}
}
// find out index of the last session
+ const QString canonicalLastSession = QFileInfo(stateConfig.Last.Session.get()).canonicalFilePath();
for (int i = 0; i < d->sessions.size(); ++i) {
- if (d->sessions.at(i)->fileName() == stateConfig.Last.Session.get()) {
+ const QString canonicalSession = QFileInfo(d->sessions.at(i)->fileName()).canonicalFilePath();
+ if (canonicalSession == canonicalLastSession) {
d->lastIndex = i;
break;
}
--
2.39.1

View File

@@ -0,0 +1,117 @@
From 8fbb69ab2cfe0f8ab4c8ca31fa0f571ba165b16d Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 15 Jul 2024 21:13:35 +0200
Subject: [PATCH 3/5] Load autologin configuration in Display::Display
Makes m_autologinSession more easily available and simplifies runtime
handling.
---
src/daemon/Display.cpp | 53 +++++++++++++++++++-----------------------
src/daemon/Display.h | 3 ++-
2 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 91e4dac..56b9b8a 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -171,6 +171,27 @@ namespace SDDM {
stop();
});
connect(m_greeter, &Greeter::displayServerFailed, this, &Display::displayServerFailed);
+
+ // Load autologin configuration (whether to autologin, user, session, session type)
+ if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
+ !mainConfig.Autologin.User.get().isEmpty()) {
+ // reset first flag
+ daemonApp->first = false;
+
+ // determine session type
+ QString autologinSession = mainConfig.Autologin.Session.get();
+ // not configured: try last successful logged in
+ if (autologinSession.isEmpty()) {
+ autologinSession = stateConfig.Last.Session.get();
+ }
+ if (findSessionEntry(mainConfig.Wayland.SessionDir.get(), autologinSession)) {
+ m_autologinSession.setTo(Session::WaylandSession, autologinSession);
+ } else if (findSessionEntry(mainConfig.X11.SessionDir.get(), autologinSession)) {
+ m_autologinSession.setTo(Session::X11Session, autologinSession);
+ } else {
+ qCritical() << "Unable to find autologin session entry" << autologinSession;
+ }
+ }
}
Display::~Display() {
@@ -213,31 +234,6 @@ namespace SDDM {
return m_displayServer->start();
}
- bool Display::attemptAutologin() {
- Session::Type sessionType = Session::X11Session;
-
- // determine session type
- QString autologinSession = mainConfig.Autologin.Session.get();
- // not configured: try last successful logged in
- if (autologinSession.isEmpty()) {
- autologinSession = stateConfig.Last.Session.get();
- }
- if (findSessionEntry(mainConfig.Wayland.SessionDir.get(), autologinSession)) {
- sessionType = Session::WaylandSession;
- } else if (findSessionEntry(mainConfig.X11.SessionDir.get(), autologinSession)) {
- sessionType = Session::X11Session;
- } else {
- qCritical() << "Unable to find autologin session entry" << autologinSession;
- return false;
- }
-
- Session session;
- session.setTo(sessionType, autologinSession);
-
- m_auth->setAutologin(true);
- return startAuth(mainConfig.Autologin.User.get(), QString(), session);
- }
-
void Display::startSocketServerAndGreeter() {
// start socket server
m_socketServer->start(m_displayServer->display());
@@ -276,13 +272,12 @@ namespace SDDM {
// log message
qDebug() << "Display server started.";
- if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
- !mainConfig.Autologin.User.get().isEmpty()) {
+ if (m_autologinSession.isValid()) {
// reset first flag
daemonApp->first = false;
- const bool autologinStarted = attemptAutologin();
- if (!autologinStarted)
+ m_auth->setAutologin(true);
+ if (!startAuth(mainConfig.Autologin.User.get(), QString(), m_autologinSession))
handleAutologinFailure();
return;
diff --git a/src/daemon/Display.h b/src/daemon/Display.h
index b215852..d0b23c4 100644
--- a/src/daemon/Display.h
+++ b/src/daemon/Display.h
@@ -72,7 +72,6 @@ namespace SDDM {
void login(QLocalSocket *socket,
const QString &user, const QString &password,
const Session &session);
- bool attemptAutologin();
void displayServerStarted();
signals:
@@ -103,6 +102,8 @@ namespace SDDM {
QString m_sessionName;
QString m_reuseSessionId;
+ Session m_autologinSession;
+
Auth *m_auth { nullptr };
DisplayServer *m_displayServer { nullptr };
Seat *m_seat { nullptr };
--
2.46.0

View File

@@ -0,0 +1,58 @@
From ee66831cd420cf2b35b6a91d0d0afe57b11b2dd2 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 15 Jul 2024 21:19:58 +0200
Subject: [PATCH 4/5] Reset daemonApp->first in the Display constructor
Simplifies the code and makes really sure that only the first display has
this set.
---
src/daemon/Display.cpp | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 56b9b8a..9167ebf 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -175,9 +175,6 @@ namespace SDDM {
// Load autologin configuration (whether to autologin, user, session, session type)
if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
!mainConfig.Autologin.User.get().isEmpty()) {
- // reset first flag
- daemonApp->first = false;
-
// determine session type
QString autologinSession = mainConfig.Autologin.Session.get();
// not configured: try last successful logged in
@@ -192,6 +189,9 @@ namespace SDDM {
qCritical() << "Unable to find autologin session entry" << autologinSession;
}
}
+
+ // reset first flag
+ daemonApp->first = false;
}
Display::~Display() {
@@ -254,9 +254,6 @@ namespace SDDM {
// start greeter
m_greeter->start();
-
- // reset first flag
- daemonApp->first = false;
}
void Display::handleAutologinFailure() {
@@ -273,9 +270,6 @@ namespace SDDM {
qDebug() << "Display server started.";
if (m_autologinSession.isValid()) {
- // reset first flag
- daemonApp->first = false;
-
m_auth->setAutologin(true);
if (!startAuth(mainConfig.Autologin.User.get(), QString(), m_autologinSession))
handleAutologinFailure();
--
2.46.0

View File

@@ -0,0 +1,86 @@
From 080f38676b1c9e1596effb0ff39c8d1f96775a89 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 15 Jul 2024 21:23:53 +0200
Subject: [PATCH 5/5] If autologin is used, avoid starting a display server for
the greeter
Introduce a new "early autologin" path that starts the session without
starting the display server first. This avoids starting a rootful X just
to then ignore it and start a Wayland session in a separate VT.
---
src/daemon/Display.cpp | 29 ++++++++++++++++++++++++++---
src/daemon/Display.h | 2 +-
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 9167ebf..e10977e 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -231,6 +231,18 @@ namespace SDDM {
m_started = true;
+ // Handle autologin early, unless it needs the display server to be up
+ // (rootful X + X11 autologin session).
+ if (m_autologinSession.isValid()
+ && !(m_displayServerType == X11DisplayServerType
+ && m_autologinSession.type() == Session::X11Session)) {
+ m_auth->setAutologin(true);
+ if (startAuth(mainConfig.Autologin.User.get(), QString(), m_autologinSession))
+ return true;
+ else
+ return handleAutologinFailure();
+ }
+
return m_displayServer->start();
}
@@ -256,10 +268,17 @@ namespace SDDM {
m_greeter->start();
}
- void Display::handleAutologinFailure() {
+ bool Display::handleAutologinFailure() {
qWarning() << "Autologin failed!";
m_auth->setAutologin(false);
- startSocketServerAndGreeter();
+ // For late autologin handling only the greeter needs to be started.
+ if (m_displayServerType == X11DisplayServerType
+ && m_autologinSession.type() == Session::X11Session) {
+ startSocketServerAndGreeter();
+ return true;
+ } else {
+ return m_displayServer->start();
+ }
}
void Display::displayServerStarted() {
@@ -269,7 +288,11 @@ namespace SDDM {
// log message
qDebug() << "Display server started.";
- if (m_autologinSession.isValid()) {
+ // Handle autologin late if it needs the display server to be up
+ // (rootful X + X11 autologin session).
+ if (m_autologinSession.isValid()
+ && (m_displayServerType == X11DisplayServerType
+ && m_autologinSession.type() == Session::X11Session)) {
m_auth->setAutologin(true);
if (!startAuth(mainConfig.Autologin.User.get(), QString(), m_autologinSession))
handleAutologinFailure();
diff --git a/src/daemon/Display.h b/src/daemon/Display.h
index d0b23c4..c2741ea 100644
--- a/src/daemon/Display.h
+++ b/src/daemon/Display.h
@@ -89,7 +89,7 @@ namespace SDDM {
const Session &session);
void startSocketServerAndGreeter();
- void handleAutologinFailure();
+ bool handleAutologinFailure();
DisplayServerType m_displayServerType = X11DisplayServerType;
--
2.46.0

3
sddm/10-theme.conf Normal file
View File

@@ -0,0 +1,3 @@
[Theme]
Current=breeze-openSUSE
CursorTheme=breeze_cursors

View File

@@ -0,0 +1,6 @@
[General]
GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
[Wayland]
# --locale1 was introduced in kwin 5.27
CompositorCommand=kwin_wayland --no-global-shortcuts --no-lockscreen --locale1

View File

@@ -0,0 +1,20 @@
sddm_start_proc () {
if [ -x /usr/bin/plymouth ]; then
/usr/bin/plymouth quit
fi
return 0
}
sddm_vars() {
case $1 in
sddm)
DISPLAYMANAGER=/usr/bin/sddm
STARTPROC=sddm_start_proc
RELOADPROC=sddm_start_proc
;;
*)
return 1
;;
esac
return 0
}

3
sddm/_multibuild Normal file
View File

@@ -0,0 +1,3 @@
<multibuild>
<flavor>qt6</flavor>
</multibuild>

BIN
sddm/sddm-0.21.0.tar.gz Normal file

Binary file not shown.

11
sddm/sddm-autologin.pam Normal file
View File

@@ -0,0 +1,11 @@
#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_permit.so
account substack common-account
account include postlogin-account
password substack common-password
password include postlogin-password
session required pam_loginuid.so
session optional pam_keyinit.so revoke force
session substack common-session
session include postlogin-session

9
sddm/sddm-greeter.pam Normal file
View File

@@ -0,0 +1,9 @@
#%PAM-1.0
# PAM configuration used only for the greeter session
auth required pam_permit.so
account required pam_permit.so
password required pam_deny.so
session required pam_loginuid.so
session optional pam_keyinit.so revoke
# We need pam_systemd, so can't use -nologin here.
session substack common-session

View File

@@ -0,0 +1,12 @@
Index: sddm-0.21.0/services/sddm.service.in
===================================================================
--- sddm-0.21.0.orig/services/sddm.service.in
+++ sddm-0.21.0/services/sddm.service.in
@@ -2,6 +2,7 @@
Description=Simple Desktop Display Manager
Documentation=man:sddm(1) man:sddm.conf(5)
Conflicts=getty@tty${SDDM_INITIAL_VT}.service
+Wants=plymouth-quit.service
After=systemd-user-sessions.service getty@tty${SDDM_INITIAL_VT}.service plymouth-quit.service systemd-logind.service
PartOf=graphical.target
StartLimitIntervalSec=30

1185
sddm/sddm.changes Normal file

File diff suppressed because it is too large Load Diff

11
sddm/sddm.pam Normal file
View File

@@ -0,0 +1,11 @@
#%PAM-1.0
auth requisite pam_nologin.so
auth substack common-auth
account substack common-account
account include postlogin-account
password substack common-password
password include postlogin-password
session required pam_loginuid.so
session optional pam_keyinit.so revoke force
session substack common-session
session include postlogin-session

340
sddm/sddm.spec Normal file
View File

@@ -0,0 +1,340 @@
#
# spec file for package sddm
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Packaging for Qt 5 and Qt 6 flavors:
# The daemon using Qt 5 can use sddm-greeter-qt6 and vice versa,
# the only restriction is that the Qt X daemon defaults to run sddm-greeter-qtX
# so that should be treated as a hard requirement. The default flavor builds
# daemon and greeter with Qt 5 while the qt6 flavor builds both with Qt 6:
# sddm builds sddm, sddm-greeter-qt5, sddm-branding-openSUSE
# sddm:qt6 builds sddm-qt6, sddm-greeter-qt6.
# There is a PR pending (#1790) to build both greeters in one go, but here we
# build them separately to allow separation with _multibuild flavors.
%if "@BUILD_FLAVOR@" == "qt6"
%global qt6 1
%global qtver 6
%else
%global qt6 0
%global qtver 5
%endif
# The .spec file name has to match the first Name:
%if !%qt6
Name: sddm
%else
Name: sddm-qt6
%endif
Version: 0.21.0
Release: 0
Summary: QML-based display manager (Qt%{qtver})
License: GPL-2.0-or-later
Group: System/GUI/KDE
URL: https://github.com/sddm/sddm
Source: https://github.com/sddm/sddm/archive/v%{version}/sddm-%{version}.tar.gz
Source1: X11-displaymanagers-sddm
# Distro configs
Source10: 00-general.conf
Source11: 10-theme.conf
# Use kwin_wayland for DisplayServer=wayland.
# Adapted from https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/5.27/sddm-wayland-session/plasma-wayland.conf
Source12: 11-kwin_wayland.conf
# PAM configuration
Source20: sddm.pam
Source21: sddm-autologin.pam
Source22: sddm-greeter.pam
# Patch0-100: PATCH-FIX-UPSTREAM
Patch0: 0001-CMake-Raise-required-version-to-3.5.patch
# https://github.com/sddm/sddm/pull/1779
Patch50: 0001-Redesign-login-shell-use-in-session-scripts.patch
# Part of https://github.com/sddm/sddm/pull/1896
Patch51: 0001-Fix-terminal-clearing.patch
# https://github.com/sddm/sddm/pull/1904
Patch52: 0001-Use-xrdb-to-set-Xcursor.theme.patch
# https://github.com/sddm/sddm/pull/1969
Patch53: 0001-Remove-unused-Display-m_relogin-variable.patch
Patch54: 0002-Set-Display-m_started-early.patch
Patch55: 0003-Load-autologin-configuration-in-Display-Display.patch
Patch56: 0004-Reset-daemonApp-first-in-the-Display-constructor.patch
Patch57: 0005-If-autologin-is-used-avoid-starting-a-display-server.patch
# Patch100-?: PATCH-FIX-OPENSUSE
Patch101: 0001-Write-the-daemon-s-PID-to-a-file-on-startup.patch
Patch102: 0001-Set-XAUTHLOCALHOSTNAME-in-sessions.patch
Patch103: 0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch
Patch104: sddm-service-handle-plymouth.patch
Patch107: 0003-Leave-duplicate-symlinks-out-of-the-SessionModel.patch
BuildRequires: cmake
BuildRequires: fdupes
%if 0%{?suse_version} <= 1500
BuildRequires: gcc13-PIE
BuildRequires: gcc13-c++
%endif
BuildRequires: pam-devel
BuildRequires: pkgconfig
# Autodetect UID_MIN and UID_MAX from /etc/login.defs
BuildRequires: shadow
BuildRequires: python3-docutils
BuildRequires: sysuser-tools
%if %qt6
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6DBus)
BuildRequires: cmake(Qt6LinguistTools)
BuildRequires: cmake(Qt6Network)
BuildRequires: cmake(Qt6Quick)
BuildRequires: cmake(Qt6QuickTest)
BuildRequires: cmake(Qt6Test)
%else
BuildRequires: cmake(Qt5Core) >= 5.15.0
BuildRequires: cmake(Qt5DBus)
BuildRequires: cmake(Qt5LinguistTools)
BuildRequires: cmake(Qt5Network)
BuildRequires: cmake(Qt5Quick)
BuildRequires: cmake(Qt5QuickTest)
BuildRequires: cmake(Qt5Test)
%endif
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(xcb-xkb)
%systemd_requires
%sysusers_requires
BuildRequires: update-alternatives
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires: sddm-greeter-qt%{qtver} = %{version}
Requires: xdm
%if %qt6
Provides: sddm = %{version}
# Most themes use Qt 5, just always provide support for now.
Requires: sddm-greeter-qt5
Conflicts: sddm
%else
Provides: sddm-qt5 = %{version}
# Merged the -lang package back into the main package
Provides: sddm-lang = %{version}
Obsoletes: sddm-lang < %{version}
%endif
%description
SDDM is a display manager for X11 and Wayland. It uses technologies like
QtQuick, which gives the designer the ability to create animated user
interfaces.
%package -n sddm-greeter-qt%{qtver}
Summary: SDDM Greeter for Qt%{qtver} themes
Group: System/GUI/KDE
Requires: sddm = %{version}
%description -n sddm-greeter-qt%{qtver}
This package provides the SDDM frontend for themes using Qt %qtver.
%package branding-openSUSE
Summary: openSUSE branding for SDDM (Qt%{qtver})
Group: System/GUI/KDE
BuildArch: noarch
Requires: %{name} = %{version}
Requires: sddm-theme-openSUSE
# See 11-kwin_wayland.conf
Requires: kwin5 >= 5.26.90
Supplements: (plasma5-workspace and branding-openSUSE)
Conflicts: %{name}-branding
Provides: %{name}-branding = %{version}
%description branding-openSUSE
This package provides the openSUSE branding for SDDM.
%prep
%autosetup -p1 -n sddm-%{version}
%build
LOGIN_DEFS_PATH="%{_sysconfdir}/login.defs"
[ -e "$LOGIN_DEFS_PATH" ] || LOGIN_DEFS_PATH="%{_distconfdir}/login.defs"
# SDDM_INITIAL_VT does not work for X: https://github.com/sddm/sddm/issues/1650
%cmake \
-DBUILD_WITH_QT6:BOOL=%{qt6} \
-DCMAKE_INSTALL_LIBEXECDIR="%{_libexecdir}/sddm" \
-DSESSION_COMMAND="%{_sysconfdir}/X11/xdm/Xsession" \
-DBUILD_MAN_PAGES=ON \
-DSTATE_DIR="%{_localstatedir}/lib/sddm" \
-DDBUS_CONFIG_DIR=%{_datadir}/dbus-1/system.d \
-DRUNTIME_DIR="/run/sddm" \
-DPID_FILE="/run/sddm.pid" \
-DLOGIN_DEFS_PATH:path="${LOGIN_DEFS_PATH}" \
-DINSTALL_PAM_CONFIGURATION:BOOL=OFF \
%if 0%{?suse_version} <= 1500
-DCMAKE_C_COMPILER:STRING=gcc-13 \
-DCMAKE_CXX_COMPILER:STRING=g++-13 \
%endif
%cmake_build
%install
%cmake_install
pushd %{buildroot}%{_datadir}/dbus-1/system.d
mv org.freedesktop.DisplayManager.conf sddm_org.freedesktop.DisplayManager.conf
popd
install -Dm 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/X11/displaymanagers/sddm
install -Dm 0644 %{SOURCE10} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf
# Adjust paths to X session scripts in 00-general.conf
sed -e 's-/usr/etc-%{?_distconfdir}%{!?_distconfdir:%{_sysconfdir}}-g' -i %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf
%if !%qt6
install -Dm 0644 %{SOURCE11} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/10-theme.conf
install -Dm 0644 %{SOURCE12} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/11-kwin_wayland.conf
%endif
# Install PAM config
pam_dest="%{?_pam_vendordir}%{!?_pam_vendordir:%{_sysconfdir}/pam.d}"
install -Dm 0644 %{SOURCE20} %{buildroot}${pam_dest}/sddm
install -Dm 0644 %{SOURCE21} %{buildroot}${pam_dest}/sddm-autologin
install -Dm 0644 %{SOURCE22} %{buildroot}${pam_dest}/sddm-greeter
# Make it compatible on older systems
%if 0%{?suse_version} < 1550
sed -i'' '/postlogin-/d' %{buildroot}${pam_dest}/*
%endif
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/default-displaymanager
ln -s %{_sysconfdir}/alternatives/default-displaymanager %{buildroot}%{_prefix}/lib/X11/displaymanagers/default-displaymanager
install -d %{buildroot}%{_rundir}/sddm
install -d %{buildroot}%{_localstatedir}/lib/sddm
install -d %{buildroot}%{_sysconfdir}/sddm.conf.d
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcsddm
%sysusers_generate_pre %{buildroot}%{_sysusersdir}/sddm.conf sddm sddm.conf
%fdupes %{buildroot}%{_datadir}/sddm
%check
%ctest
%pre -f sddm.pre
%service_add_pre sddm.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in pam.d/sddm pam.d/sddm-autologin pam.d/sddm-greeter ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
# Previous versions owned /etc/sddm.conf, on upgrade it will be moved to .rpmsave if it was changed
# on disk. To keep the user configuration intact, it has to be moved back in posttrans.
# This also works for switching between sddm and sddm-qt6 in one transaction.
# However, if both /etc/sddm.conf and /etc/sddm.conf.rpmsave exist already, there are special cases:
# 1. /etc/sddm.conf was not changed on disk. It will be deleted instead of renamed to .rpmsave.
# The posttrans script would rename the *old* .rpmsave file, restoring some ancient config.
# 2. /etc/sddm.conf was changed. The old .rpmsave file will be overwritten.
# Avoid this by moving any preexisting .rpmsave to .rpmsave.old. There is no rename back though,
# to prevent that every upgrade of the package renames it back and forth...
if [ -f %{_sysconfdir}/sddm.conf.rpmsave ]; then
mv -v %{_sysconfdir}/sddm.conf.rpmsave %{_sysconfdir}/sddm.conf.rpmsave.old
fi
%post
%service_add_post sddm.service
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/sddm.conf
%{_sbindir}/update-alternatives --install %{_prefix}/lib/X11/displaymanagers/default-displaymanager \
default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm 25
%posttrans
%if 0%{?suse_version} > 1500
# Migration to /usr/lib/pam.d/, restore just created .rpmsave
for i in pam.d/sddm pam.d/sddm-autologin pam.d/sddm-greeter; do
[ -f %{_sysconfdir}/${i}.rpmsave ] && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} || :
done
%endif
# See the pre script above
if [ -f %{_sysconfdir}/sddm.conf.rpmsave ] && ! [ -f %{_sysconfdir}/sddm.conf ]; then
mv %{_sysconfdir}/sddm.conf.rpmsave %{_sysconfdir}/sddm.conf
fi
%preun
%service_del_preun sddm.service
%postun
# Don't restart on upgrades (boo#1161826)
%if 0%{?suse_version} > 1500
%service_del_postun_without_restart sddm.service
%else
%service_del_postun -n sddm.service
%endif
[ -f %{_prefix}/lib/X11/displaymanagers/sddm ] || %{_sbindir}/update-alternatives \
--remove default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm
%files
%license LICENSE*
%doc README*
%dir %{_sysconfdir}/sddm.conf.d/
%if 0%{?suse_version} > 1500
%{_pam_vendordir}/sddm
%{_pam_vendordir}/sddm-autologin
%{_pam_vendordir}/sddm-greeter
%else
%config %{_sysconfdir}/pam.d/sddm
%config %{_sysconfdir}/pam.d/sddm-autologin
%config %{_sysconfdir}/pam.d/sddm-greeter
%endif
%{_datadir}/dbus-1/system.d/sddm_org.freedesktop.DisplayManager.conf
%dir %{_prefix}/lib/X11/displaymanagers/
%{_prefix}/lib/X11/displaymanagers/sddm
%{_prefix}/lib/X11/displaymanagers/default-displaymanager
%ghost %{_sysconfdir}/alternatives/default-displaymanager
%{_bindir}/sddm
%{_sbindir}/rcsddm
%dir %{_datadir}/sddm/
%dir %{_prefix}/lib/sddm/
%dir %{_prefix}/lib/sddm/sddm.conf.d/
%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf
%dir %{_libexecdir}/sddm
%{_libexecdir}/sddm/sddm-helper
%{_libexecdir}/sddm/sddm-helper-start-wayland
%{_libexecdir}/sddm/sddm-helper-start-x11user
%{_datadir}/sddm/faces/
%{_datadir}/sddm/flags/
%{_datadir}/sddm/scripts/
%{_datadir}/sddm/themes/
%ghost %attr(711,root,root) %dir %{_rundir}/sddm
%ghost %attr(750,sddm,sddm) %dir %{_localstatedir}/lib/sddm
%{_mandir}/man*/sddm*%{ext_man}
%{_unitdir}/sddm.service
%{_sysusersdir}/sddm.conf
%{_tmpfilesdir}/sddm.conf
%files -n sddm-greeter-qt%{qtver}
%if %qtver == 5
%{_bindir}/sddm-greeter
%else
%{_bindir}/sddm-greeter-qt%{qtver}
%endif
%{_libdir}/qt%{qtver}/qml/
%{_datadir}/sddm/translations-qt%{qtver}/
# The Plasma 6 branding is supplied by plasma6-workspace
%if !%qt6
%files branding-openSUSE
%license LICENSE*
%doc README*
%{_prefix}/lib/sddm/sddm.conf.d/10-theme.conf
%{_prefix}/lib/sddm/sddm.conf.d/11-kwin_wayland.conf
%endif
%changelog