Skip to content

Commit

Permalink
add: terra-sddm (#1204)
Browse files Browse the repository at this point in the history
* add: sddm

* fix: terra-sddm instead of just sddm

(cherry picked from commit 61ee2b6)
  • Loading branch information
madonuko authored and raboneko committed May 5, 2024
1 parent 0928578 commit b85494d
Show file tree
Hide file tree
Showing 17 changed files with 1,795 additions and 0 deletions.
142 changes: 142 additions & 0 deletions anda/desktops/sddm/0001-Delay-for-logind-and-fallback-to-seat0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
From 4d44531c8f624f5b479c3ff23e8fecc67eb848ab Mon Sep 17 00:00:00 2001
From: Jeremy Linton <[email protected]>
Date: Fri, 22 Oct 2021 14:51:54 -0500
Subject: [PATCH] Delay for logind, and fallback to seat0

There is systemd/logind race with when restarting
sddm that causes logind1 not to be available. Previously
this meant the seat0 was immediately created regardless
of the state of CanGraphical.

Fixing this, though we still want seat0 to be started
if none of the seats appear to be graphical. Presumably
there are some graphics on the machine, otherwise
why run sddm? Wait a bit, and create seat0 anyway. If
this fails the output from Xorg should tell us why. This
is generally a better strategy than what happens a good
amount of time now, where sddm is started and silent about
why the screen is blank.

References:
* https://bugzilla.redhat.com/2011991
* https://bugzilla.redhat.com/2016310

Signed-off-by: Jeremy Linton <[email protected]>
---
src/daemon/LogindDBusTypes.cpp | 31 +++++++++++++++++++++----------
src/daemon/SeatManager.cpp | 22 ++++++++++++++++++++++
src/daemon/SeatManager.h | 1 +
3 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/src/daemon/LogindDBusTypes.cpp b/src/daemon/LogindDBusTypes.cpp
index 011bb7f..6255c69 100644
--- a/src/daemon/LogindDBusTypes.cpp
+++ b/src/daemon/LogindDBusTypes.cpp
@@ -8,6 +8,8 @@

#include <QDebug>

+#include <unistd.h>
+
class LogindPathInternal {
public:
LogindPathInternal();
@@ -46,17 +48,26 @@ LogindPathInternal::LogindPathInternal()
qRegisterMetaType<UserInfoList>("UserInfoList");
qDBusRegisterMetaType<UserInfoList>();

- if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.login1"))) {
- qDebug() << "Logind interface found";
- available = true;
- serviceName = QStringLiteral("org.freedesktop.login1");
- managerPath = QStringLiteral("/org/freedesktop/login1");
- managerIfaceName = QStringLiteral("org.freedesktop.login1.Manager");
- seatIfaceName = QStringLiteral("org.freedesktop.login1.Seat");
- sessionIfaceName = QStringLiteral("org.freedesktop.login1.Session");
- userIfaceName = QStringLiteral("org.freedesktop.login1.User");
- return;
+#ifdef HAVE_SYSTEMD
+ // systemd-logind should be running, although because it takes a few moments to restart after
+ // systemctl isolate calls, it may not yet be running. Wait a few seconds for it, while blocking everything else.
+ int logind_wait_seconds = 50;
+ while (logind_wait_seconds--) {
+ if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.login1"))) {
+ qDebug() << "Logind interface found";
+ available = true;
+ serviceName = QStringLiteral("org.freedesktop.login1");
+ managerPath = QStringLiteral("/org/freedesktop/login1");
+ managerIfaceName = QStringLiteral("org.freedesktop.login1.Manager");
+ seatIfaceName = QStringLiteral("org.freedesktop.login1.Seat");
+ sessionIfaceName = QStringLiteral("org.freedesktop.login1.Session");
+ userIfaceName = QStringLiteral("org.freedesktop.login1.User");
+ return;
+ }
+ qDebug() << "Sleeping for systemd-logind";
+ usleep(100000);
}
+#endif

if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.ConsoleKit"))) {
qDebug() << "Console kit interface found";
diff --git a/src/daemon/SeatManager.cpp b/src/daemon/SeatManager.cpp
index bd207e6..39d8b85 100644
--- a/src/daemon/SeatManager.cpp
+++ b/src/daemon/SeatManager.cpp
@@ -26,6 +26,9 @@
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <QDBusContext>
+#include <QDebug>
+#include <QFileInfo>
+#include <QTimer>

#include "LogindDBusTypes.h"

@@ -115,6 +118,8 @@ namespace SDDM {

QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatNew"), this, SLOT(logindSeatAdded(QString,QDBusObjectPath)));
QDBusConnection::systemBus().connect(Logind::serviceName(), Logind::managerPath(), Logind::managerIfaceName(), QStringLiteral("SeatRemoved"), this, SLOT(logindSeatRemoved(QString,QDBusObjectPath)));
+
+ QTimer::singleShot(5000, this, &SeatManager::checkSeat);
}

void SeatManager::createSeat(const QString &name) {
@@ -152,6 +157,23 @@ namespace SDDM {
m_seats.value(name)->createDisplay(Display::defaultDisplayServerType());
}

+ // this is a bit hacky, but linux DRM drivers
+ // won't initially be available so there is a race
+ // between determing if a efifb/etc graphical object
+ // is the only graphics on the machine, or a DRM driver
+ // will take over the display. So we will hang out for a few
+ // seconds and if none of the seats are declared cangraphical
+ // its possible the only graphics on the machine don't have
+ // a drm driver.
+ void SeatManager::checkSeat(void) {
+ if (m_seats.isEmpty()) {
+ //if (QFileInfo::exists(QStringLiteral("/dev/fb0"))) {
+ qWarning() << "No graphical seats found, attempt to start one on the main console anyway...";
+ createSeat(QStringLiteral("seat0"));
+ //}
+ }
+ }
+
void SDDM::SeatManager::logindSeatAdded(const QString& name, const QDBusObjectPath& objectPath)
{
auto logindSeat = new LogindSeat(name, objectPath);
diff --git a/src/daemon/SeatManager.h b/src/daemon/SeatManager.h
index b2f9796..aa43047 100644
--- a/src/daemon/SeatManager.h
+++ b/src/daemon/SeatManager.h
@@ -49,6 +49,7 @@ namespace SDDM {
private:
QHash<QString, Seat *> m_seats; //these will exist only for graphical seats
QHash<QString, LogindSeat*> m_systemSeats; //these will exist for all seats
+ void checkSeat(void);
};
}

--
2.39.2

2 changes: 2 additions & 0 deletions anda/desktops/sddm/README.scripts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This scripts dir contains only samples, but are generally not used directly.
In practice, sddm runtime uses items under /etc/sddm by default
5 changes: 5 additions & 0 deletions anda/desktops/sddm/anda.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project pkg {
rpm {
spec = "terra-sddm.spec"
}
}
11 changes: 11 additions & 0 deletions anda/desktops/sddm/sddm-0.18.0-environment_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -up sddm-0.18.0/services/sddm.service.in.env sddm-0.18.0/services/sddm.service.in
--- sddm-0.18.0/services/sddm.service.in.env 2018-07-18 05:31:40.000000000 -0500
+++ sddm-0.18.0/services/sddm.service.in 2019-03-14 08:23:22.095498405 -0500
@@ -7,6 +7,7 @@ After=systemd-user-sessions.service gett
[Service]
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/sddm
Restart=always
+EnvironmentFile=-/etc/sysconfig/sddm

[Install]
Alias=display-manager.service
53 changes: 53 additions & 0 deletions anda/desktops/sddm/sddm-0.20.0-fedora_config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/src/common/Configuration.h b/src/common/Configuration.h
index 54bcace..9b8fa22 100644
--- a/src/common/Configuration.h
+++ b/src/common/Configuration.h
@@ -37,9 +37,8 @@ namespace SDDM {
enum NumState { NUM_NONE, NUM_SET_ON, NUM_SET_OFF };

// Name Type Default value Description
- // TODO: Change default to x11-user in a future release
- Entry(DisplayServer, QString, _S("x11"), _S("Which display server should be used.\n"
- "Valid values are: x11, x11-user, wayland. Wayland support is experimental"));
+ Entry(DisplayServer, QString, _S("wayland"), _S("Which display server should be used.\n"
+ "Valid values are: x11, x11-user, wayland."));
Entry(HaltCommand, QString, _S(HALT_COMMAND), _S("Halt command"));
Entry(RebootCommand, QString, _S(REBOOT_COMMAND), _S("Reboot command"));
Entry(Numlock, NumState, NUM_NONE, _S("Initial NumLock state. Can be on, off or none.\n"
@@ -51,7 +50,7 @@ namespace SDDM {
// Name Entries (but it's a regular class again)
Section(Theme,
Entry(ThemeDir, QString, _S(DATA_INSTALL_DIR "/themes"), _S("Theme directory path"));
- Entry(Current, QString, _S(""), _S("Current theme name"));
+ Entry(Current, QString, _S("01-breeze-fedora"), _S("Current theme name"));
Entry(FacesDir, QString, _S(DATA_INSTALL_DIR "/faces"), _S("Global directory for user avatars\n"
"The files should be named <username>.face.icon"));
Entry(CursorTheme, QString, QString(), _S("Cursor theme used in the greeter"));
@@ -71,9 +70,9 @@ namespace SDDM {
Entry(SessionDir, QStringList, {_S("/usr/local/share/xsessions"),
_S("/usr/share/xsessions")}, _S("Comma-separated list of directories containing available X sessions"));
Entry(SessionCommand, QString, _S(SESSION_COMMAND), _S("Path to a script to execute when starting the desktop session"));
- Entry(SessionLogFile, QString, _S(".local/share/sddm/xorg-session.log"), _S("Path to the user session log file"));
- Entry(DisplayCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xsetup"), _S("Path to a script to execute when starting the display server"));
- Entry(DisplayStopCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xstop"), _S("Path to a script to execute when stopping the display server"));
+ Entry(SessionLogFile, QString, _S(".cache/xsession-errors"), _S("Path to the user session log file"));
+ Entry(DisplayCommand, QString, _S(SYS_CONFIG_DIR "/sddm/Xsetup"), _S("Path to a script to execute when starting the display server"));
+ Entry(DisplayStopCommand, QString, _S(SYS_CONFIG_DIR "/sddm/Xstop"), _S("Path to a script to execute when stopping the display server"));
Entry(EnableHiDPI, bool, true, _S("Enable Qt's automatic high-DPI scaling"));
);

@@ -82,12 +81,12 @@ namespace SDDM {
Entry(SessionDir, QStringList, {_S("/usr/local/share/wayland-sessions"),
_S("/usr/share/wayland-sessions")}, _S("Comma-separated list of directories containing available Wayland sessions"));
Entry(SessionCommand, QString, _S(WAYLAND_SESSION_COMMAND), _S("Path to a script to execute when starting the desktop session"));
- Entry(SessionLogFile, QString, _S(".local/share/sddm/wayland-session.log"),_S("Path to the user session log file"));
+ Entry(SessionLogFile, QString, _S(".cache/wayland-errors"), _S("Path to the user session log file"));
Entry(EnableHiDPI, bool, true, _S("Enable Qt's automatic high-DPI scaling"));
);

Section(Users,
- Entry(DefaultPath, QString, _S("/usr/local/bin:/usr/bin:/bin"), _S("Default $PATH for logged in users"));
+ Entry(DefaultPath, QString, _S("/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"), _S("Default $PATH for logged in users"));
Entry(MinimumUid, int, UID_MIN, _S("Minimum user id for displayed users"));
Entry(MaximumUid, int, UID_MAX, _S("Maximum user id for displayed users"));
Entry(HideUsers, QStringList, QStringList(), _S("Comma-separated list of users that should not be listed"));
67 changes: 67 additions & 0 deletions anda/desktops/sddm/sddm-0.21.0-qt6greeter.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
From 52175648f4e1b415f93b24a3ef970983024659f2 Mon Sep 17 00:00:00 2001
From: Neal Gompa <[email protected]>
Date: Wed, 28 Feb 2024 16:47:16 -0500
Subject: [PATCH] Default to Qt6 and always use versioned greeters

Distributors can handle creating an unversioned name if necessary.
---
src/common/ThemeMetadata.cpp | 4 ++--
src/daemon/Greeter.cpp | 3 +--
src/greeter/CMakeLists.txt | 9 +--------
3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/common/ThemeMetadata.cpp b/src/common/ThemeMetadata.cpp
index 2cb3762..003056a 100644
--- a/src/common/ThemeMetadata.cpp
+++ b/src/common/ThemeMetadata.cpp
@@ -28,7 +28,7 @@ namespace SDDM {
QString mainScript { QStringLiteral("Main.qml") };
QString configFile;
QString translationsDirectory { QStringLiteral(".") };
- int qtVersion = 5;
+ int qtVersion = 6;
};

ThemeMetadata::ThemeMetadata(const QString &path, QObject *parent) : QObject(parent), d(new ThemeMetadataPrivate()) {
@@ -61,6 +61,6 @@ namespace SDDM {
d->mainScript = settings.value(QStringLiteral("SddmGreeterTheme/MainScript"), QStringLiteral("Main.qml")).toString();
d->configFile = settings.value(QStringLiteral("SddmGreeterTheme/ConfigFile"), QStringLiteral("theme.conf")).toString();
d->translationsDirectory = settings.value(QStringLiteral("SddmGreeterTheme/TranslationsDirectory"), QStringLiteral(".")).toString();
- d->qtVersion = settings.value(QStringLiteral("SddmGreeterTheme/QtVersion"), 5).toInt();
+ d->qtVersion = settings.value(QStringLiteral("SddmGreeterTheme/QtVersion"), 6).toInt();
}
}
diff --git a/src/daemon/Greeter.cpp b/src/daemon/Greeter.cpp
index 07fccde..5a956b6 100644
--- a/src/daemon/Greeter.cpp
+++ b/src/daemon/Greeter.cpp
@@ -82,8 +82,7 @@ namespace SDDM {

QString Greeter::greeterPathForQt(int qtVersion)
{
- const QString suffix = qtVersion == 5 ? QString() : QStringLiteral("-qt%1").arg(qtVersion);
- return QStringLiteral(BIN_INSTALL_DIR "/sddm-greeter%1").arg(suffix);
+ return QStringLiteral(BIN_INSTALL_DIR "/sddm-greeter-qt%1").arg(qtVersion);
}

bool Greeter::start() {
diff --git a/src/greeter/CMakeLists.txt b/src/greeter/CMakeLists.txt
index 72769e4..524368d 100644
--- a/src/greeter/CMakeLists.txt
+++ b/src/greeter/CMakeLists.txt
@@ -1,11 +1,4 @@
-if(QT_MAJOR_VERSION EQUAL "5")
- # Keep the unversioned name for Qt5. When upgrading SDDM, the old daemon
- # might still be running and only know about "sddm-greeter". Keeping the
- # previous name around also helps users calling it directly.
- set(GREETER_TARGET sddm-greeter)
-else()
- set(GREETER_TARGET sddm-greeter-qt${QT_MAJOR_VERSION})
-endif()
+set(GREETER_TARGET sddm-greeter-qt${QT_MAJOR_VERSION})

message(STATUS "Building greeter for Qt ${QT_MAJOR_VERSION} as ${GREETER_TARGET}")

--
2.43.0

Loading

0 comments on commit b85494d

Please sign in to comment.