Drop Xorg support

Resolves: RHEL-31479
This commit is contained in:
Ray Strode 2024-07-26 14:26:15 -04:00
parent 835960416e
commit ca22418437
2 changed files with 319 additions and 13 deletions

View File

@ -24,11 +24,11 @@ Source6: gdm.sysusers
Patch: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch Patch: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch
Patch: 0001-data-add-system-dconf-databases-to-gdm-profile.patch Patch: 0001-data-add-system-dconf-databases-to-gdm-profile.patch
Patch: 0001-xorg-detect.patch Patch: 0001-xorg-detect.patch
Patch: wayland-only.patch
BuildRequires: dconf BuildRequires: dconf
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: gettext-devel BuildRequires: gettext-devel
BuildRequires: libXdmcp-devel
BuildRequires: meson BuildRequires: meson
BuildRequires: pam-devel BuildRequires: pam-devel
BuildRequires: pkgconfig(accountsservice) >= 0.6.3 BuildRequires: pkgconfig(accountsservice) >= 0.6.3
@ -68,8 +68,6 @@ Requires: pam
Requires: /sbin/nologin Requires: /sbin/nologin
Requires: systemd >= 186 Requires: systemd >= 186
Requires: system-logos Requires: system-logos
Requires: xhost xmodmap xrdb
Requires: xorg-x11-xinit
# Until the greeter gets dynamic user support, it can't # Until the greeter gets dynamic user support, it can't
# use a user bus # use a user bus
@ -85,9 +83,7 @@ functionality for logging in a user and unlocking the user's session after
it's been locked. GDM also provides functionality for initiating user-switching, it's been locked. GDM also provides functionality for initiating user-switching,
so more than one user can be logged in at the same time. It handles so more than one user can be logged in at the same time. It handles
graphical session registration with the system for both local and remote graphical session registration with the system for both local and remote
sessions (in the latter case, via the XDMCP protocol). In cases where the sessions (in the latter case, via GNOME Remote Desktop and the RDP protocol).
session doesn't provide it's own display server, GDM can start the display
server on behalf of the session.
%package devel %package devel
Summary: Development files for gdm Summary: Development files for gdm
@ -108,7 +104,7 @@ files that are helpful to PAM modules wishing to support
GDM specific authentication features. GDM specific authentication features.
%prep %prep
%autosetup -p1 -n gdm-%{tarball_version} %autosetup -S git -p1 -n gdm-%{tarball_version}
%build %build
%meson -Dpam-prefix=%{_sysconfdir} \ %meson -Dpam-prefix=%{_sysconfdir} \
@ -119,7 +115,9 @@ GDM specific authentication features.
-Ddistro=redhat \ -Ddistro=redhat \
-Dprofiling=true \ -Dprofiling=true \
-Dplymouth=enabled \ -Dplymouth=enabled \
-Dselinux=enabled -Dselinux=enabled \
-Dxdmcp=disabled
%meson_build %meson_build
@ -142,7 +140,8 @@ rm -rf %{buildroot}/%{_prefix}/doc
# create log dir # create log dir
mkdir -p %{buildroot}/var/log/gdm mkdir -p %{buildroot}/var/log/gdm
(cd %{buildroot}%{_sysconfdir}/gdm; ln -sf ../X11/xinit/Xsession .) rm -f %{buildroot}%{_sysconfdir}/gdm/Xsession
rm -f %{buildroot}%{_libexecdir}/gdm-x-session
mkdir -p %{buildroot}%{_datadir}/gdm/autostart/LoginWindow mkdir -p %{buildroot}%{_datadir}/gdm/autostart/LoginWindow
@ -225,7 +224,6 @@ fi
%config %{_sysconfdir}/pam.d/gdm-autologin %config %{_sysconfdir}/pam.d/gdm-autologin
%config %{_sysconfdir}/pam.d/gdm-password %config %{_sysconfdir}/pam.d/gdm-password
# not config files # not config files
%{_sysconfdir}/gdm/Xsession
%{_datadir}/gdm/gdm.schemas %{_datadir}/gdm/gdm.schemas
%{_sysconfdir}/dbus-1/system.d/gdm.conf %{_sysconfdir}/dbus-1/system.d/gdm.conf
%dir %{_sysconfdir}/gdm/Init %dir %{_sysconfdir}/gdm/Init
@ -236,12 +234,9 @@ fi
%dir %{_sysconfdir}/dconf/db/gdm.d/locks %dir %{_sysconfdir}/dconf/db/gdm.d/locks
%{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.xml %{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.override %{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.override
%{_libexecdir}/gdm-host-chooser
%{_libexecdir}/gdm-runtime-config %{_libexecdir}/gdm-runtime-config
%{_libexecdir}/gdm-session-worker %{_libexecdir}/gdm-session-worker
%{_libexecdir}/gdm-simple-chooser
%{_libexecdir}/gdm-wayland-session %{_libexecdir}/gdm-wayland-session
%{_libexecdir}/gdm-x-session
%{_sbindir}/gdm %{_sbindir}/gdm
%{_bindir}/gdmflexiserver %{_bindir}/gdmflexiserver
%{_bindir}/gdm-config %{_bindir}/gdm-config

311
wayland-only.patch Normal file
View File

@ -0,0 +1,311 @@
From a5dcb9699cbb18c70da0a6ee57faa20124130787 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 26 Jul 2024 16:21:35 -0400
Subject: [PATCH] wayland-only.patch
---
daemon/gdm-local-display-factory.c | 12 +++++++++++-
libgdm/gdm-sessions.c | 20 ++++++++++++--------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index f2d8e15..cfbd598 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -192,75 +192,81 @@ take_next_display_number (GdmLocalDisplayFactory *factory)
/* now reserve this number */
g_debug ("GdmLocalDisplayFactory: Reserving X display: %u", ret);
g_hash_table_insert (factory->used_display_numbers, GUINT_TO_POINTER (ret), NULL);
return ret;
}
static char *
get_preferred_display_server (GdmLocalDisplayFactory *factory)
{
g_autofree gchar *preferred_display_server = NULL;
gboolean wayland_enabled = FALSE, xorg_enabled = FALSE;
gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled);
gdm_settings_direct_get_boolean (GDM_KEY_XORG_ENABLE, &xorg_enabled);
if (wayland_enabled && !xorg_enabled) {
return g_strdup ("wayland");
}
if (!wayland_enabled && !xorg_enabled) {
return g_strdup ("none");
}
gdm_settings_direct_get_string (GDM_KEY_PREFERRED_DISPLAY_SERVER, &preferred_display_server);
if (g_strcmp0 (preferred_display_server, "wayland") == 0) {
if (wayland_enabled)
return g_strdup (preferred_display_server);
+#ifdef ENABLE_XORG_SUPPORT
else
return g_strdup ("xorg");
+#endif
}
if (g_strcmp0 (preferred_display_server, "xorg") == 0) {
+#ifdef ENABLE_XORG_SUPPORT
if (xorg_enabled)
return g_strdup (preferred_display_server);
else
+#endif
return g_strdup ("wayland");
}
+#ifdef ENABLE_XORG_SUPPORT
if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) {
if (xorg_enabled)
return g_strdup (preferred_display_server);
}
+#endif
return g_strdup ("none");
}
struct GdmDisplayServerConfiguration {
const char *display_server;
const char *key;
const char *binary;
const char *session_type;
} display_server_configuration[] = {
#ifdef ENABLE_WAYLAND_SUPPORT
{ "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/bin/Xwayland", "wayland" },
#endif
{ "xorg", GDM_KEY_XORG_ENABLE, "/usr/bin/Xorg", "x11" },
{ NULL, NULL, NULL },
};
static gboolean
display_server_enabled (GdmLocalDisplayFactory *factory,
const char *display_server)
{
size_t i;
for (i = 0; display_server_configuration[i].display_server != NULL; i++) {
const char *key = display_server_configuration[i].key;
const char *binary = display_server_configuration[i].binary;
gboolean enabled = FALSE;
if (!g_str_equal (display_server_configuration[i].display_server,
display_server))
@@ -289,74 +295,78 @@ get_session_type_for_display_server (GdmLocalDisplayFactory *factory,
display_server))
continue;
return display_server_configuration[i].session_type;
}
return NULL;
}
static char **
gdm_local_display_factory_get_session_types (GdmLocalDisplayFactory *factory,
gboolean should_fall_back)
{
g_autofree gchar *preferred_display_server = NULL;
const char *fallback_display_server = NULL;
gboolean wayland_preferred = FALSE;
gboolean xorg_preferred = FALSE;
g_autoptr (GPtrArray) session_types_array = NULL;
char **session_types;
session_types_array = g_ptr_array_new ();
preferred_display_server = get_preferred_display_server (factory);
g_debug ("GdmLocalDisplayFactory: Getting session type (prefers %s, falling back: %s)",
preferred_display_server, should_fall_back? "yes" : "no");
wayland_preferred = g_str_equal (preferred_display_server, "wayland");
xorg_preferred = g_str_equal (preferred_display_server, "xorg");
+#ifdef ENABLE_XORG_SUPPORT
if (wayland_preferred)
fallback_display_server = "xorg";
else if (xorg_preferred)
fallback_display_server = "wayland";
else
return NULL;
+#endif
- if (!should_fall_back) {
+ if (!should_fall_back || fallback_display_server == NULL) {
if (display_server_enabled (factory, preferred_display_server))
g_ptr_array_add (session_types_array, (gpointer) get_session_type_for_display_server (factory, preferred_display_server));
}
+#ifdef ENABLE_XORG_SUPPORT
if (display_server_enabled (factory, fallback_display_server))
g_ptr_array_add (session_types_array, (gpointer) get_session_type_for_display_server (factory, fallback_display_server));
+#endif
if (session_types_array->len == 0)
return NULL;
g_ptr_array_add (session_types_array, NULL);
session_types = g_strdupv ((char **) session_types_array->pdata);
return session_types;
}
static void
on_display_disposed (GdmLocalDisplayFactory *factory,
GdmDisplay *display)
{
g_debug ("GdmLocalDisplayFactory: Display %p disposed", display);
}
static void
store_display (GdmLocalDisplayFactory *factory,
GdmDisplay *display)
{
GdmDisplayStore *store;
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
gdm_display_store_add (store, display);
}
/*
Example:
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c
index 0aedcf9..211b6f6 100644
--- a/libgdm/gdm-sessions.c
+++ b/libgdm/gdm-sessions.c
@@ -304,115 +304,119 @@ collect_sessions_from_directory (const char *dirname)
g_autofree char *other_path = g_build_filename (dirname, other_name, NULL);
if (g_file_test (other_path, G_FILE_TEST_EXISTS)) {
g_debug ("Running under X11, ignoring %s", filename);
continue;
}
}
}
id = g_strndup (filename, strlen (filename) - strlen (".desktop"));
full_path = g_build_filename (dirname, filename, NULL);
load_session_file (id, full_path);
g_free (id);
g_free (full_path);
}
g_dir_close (dir);
}
static void
collect_sessions (void)
{
g_autoptr(GHashTable) names_seen_before = NULL;
g_autoptr(GPtrArray) xorg_search_array = NULL;
g_autoptr(GPtrArray) wayland_search_array = NULL;
gchar *session_dir = NULL;
int i;
- const char *xorg_search_dirs[] = {
- "/etc/X11/sessions/",
- DMCONFDIR "/Sessions/",
- DATADIR "/gdm/BuiltInSessions/",
- DATADIR "/xsessions/",
- };
const gchar *supported_session_types_env = NULL;
g_auto (GStrv) supported_session_types = NULL;
+ const gchar * const *system_data_dirs = g_get_system_data_dirs ();
supported_session_types_env = g_getenv ("GDM_SUPPORTED_SESSION_TYPES");
if (supported_session_types_env != NULL) {
supported_session_types = g_strsplit (supported_session_types_env, ":", -1);
}
names_seen_before = g_hash_table_new (g_str_hash, g_str_equal);
- xorg_search_array = g_ptr_array_new_with_free_func (g_free);
- const gchar * const *system_data_dirs = g_get_system_data_dirs ();
+#ifdef ENABLE_XORG_SUPPORT
+ const char *xorg_search_dirs[] = {
+ "/etc/X11/sessions/",
+ DMCONFDIR "/Sessions/",
+ DATADIR "/gdm/BuiltInSessions/",
+ DATADIR "/xsessions/",
+ };
+ xorg_search_array = g_ptr_array_new_with_free_func (g_free);
for (i = 0; system_data_dirs[i]; i++) {
session_dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
g_ptr_array_add (xorg_search_array, session_dir);
}
for (i = 0; i < G_N_ELEMENTS (xorg_search_dirs); i++) {
g_ptr_array_add (xorg_search_array, g_strdup (xorg_search_dirs[i]));
}
+#endif
#ifdef ENABLE_WAYLAND_SUPPORT
const char *wayland_search_dirs[] = {
DATADIR "/wayland-sessions/",
};
wayland_search_array = g_ptr_array_new_with_free_func (g_free);
for (i = 0; system_data_dirs[i]; i++) {
session_dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
g_ptr_array_add (wayland_search_array, session_dir);
}
for (i = 0; i < G_N_ELEMENTS (wayland_search_dirs); i++) {
g_ptr_array_add (wayland_search_array, g_strdup (wayland_search_dirs[i]));
}
#endif
if (gdm_available_sessions_map == NULL) {
gdm_available_sessions_map = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify)gdm_session_file_free);
}
+#ifdef ENABLE_XORG_SUPPORT
if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "x11")) {
for (i = xorg_search_array->len - 1; i >= 0; i--) {
collect_sessions_from_directory (g_ptr_array_index (xorg_search_array, i));
}
}
+#endif
#ifdef ENABLE_WAYLAND_SUPPORT
#ifdef ENABLE_USER_DISPLAY_SERVER
if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "wayland")) {
for (i = wayland_search_array->len - 1; i >= 0; i--) {
collect_sessions_from_directory (g_ptr_array_index (wayland_search_array, i));
}
}
#endif
#endif
g_hash_table_foreach_remove (gdm_available_sessions_map,
remove_duplicate_sessions,
names_seen_before);
}
static gint
compare_session_ids (gconstpointer a,
gconstpointer b)
{
GdmSessionFile *session_a, *session_b;
session_a = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, a);
session_b = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, b);
if (session_a == NULL)
return -1;
if (session_b == NULL)
return 1;
--
2.44.0