diff options
Diffstat (limited to 'x11/gdm/files')
30 files changed, 602 insertions, 1121 deletions
diff --git a/x11/gdm/files/15_org.gnome.login-screen.gschema.override b/x11/gdm/files/15_org.gnome.login-screen.gschema.override new file mode 100644 index 000000000000..7ddb43edbb3e --- /dev/null +++ b/x11/gdm/files/15_org.gnome.login-screen.gschema.override @@ -0,0 +1,3 @@ +[org.gnome.login-screen] +enable-fingerprint-authentication=false +enable-smartcard-authentication=false diff --git a/x11/gdm/files/Makefile.am b/x11/gdm/files/Makefile.am deleted file mode 100644 index 6bb317816bc5..000000000000 --- a/x11/gdm/files/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -$OpenBSD: patch-Makefile_am,v 1.1 2016/10/31 16:15:46 ajacoutot Exp $ - -REVERT - Linux-PAM -From 714b6af29b916ac7da0cdab6f83460574ed49cf2 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Mon, 15 Aug 2016 13:48:00 -0400 -Subject: pam_gdm: add stub pam module - ---- Makefile.am.orig 2017-10-30 16:21:02.000000000 +0100 -+++ Makefile.am 2018-01-14 12:30:07.298406000 +0100 -@@ -7,7 +7,6 @@ SUBDIRS = \ - daemon \ - libgdm \ - utils \ -- pam_gdm \ - po \ - tests \ - $(NULL) diff --git a/x11/gdm/files/client.conf.in b/x11/gdm/files/client.conf.in deleted file mode 100644 index ef886bff7259..000000000000 --- a/x11/gdm/files/client.conf.in +++ /dev/null @@ -1,2 +0,0 @@ -autospawn = no -daemon-binary = /usr/bin/true diff --git a/x11/gdm/files/configure.ac b/x11/gdm/files/configure.ac deleted file mode 100644 index 80b14caaa4d2..000000000000 --- a/x11/gdm/files/configure.ac +++ /dev/null @@ -1,154 +0,0 @@ -$OpenBSD: patch-configure_ac,v 1.12 2017/04/17 13:17:07 ajacoutot Exp $ - -REVERT - Linux-PAM -From 714b6af29b916ac7da0cdab6f83460574ed49cf2 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Mon, 15 Aug 2016 13:48:00 -0400 -Subject: pam_gdm: add stub pam module - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - -https://bugzilla.gnome.org/show_bug.cgi?id=722482 - ---- configure.ac.orig 2017-10-30 16:21:11.000000000 +0100 -+++ configure.ac 2018-01-14 13:01:16.646216000 +0100 -@@ -232,12 +232,6 @@ AM_CONDITIONAL(ENABLE_EXHERBO_PAM_CONFIG, test x$with_ - AM_CONDITIONAL(ENABLE_LFS_PAM_CONFIG, test x$with_default_pam_config = xlfs) - AM_CONDITIONAL(ENABLE_ARCH_PAM_CONFIG, test x$with_default_pam_config = xarch) - --AC_CHECK_HEADERS([security/pam_modules.h security/pam_modutil.h security/pam_ext.h], -- [have_pam=yes], -- [if test "x$have_pam" = xyes ; then -- AC_MSG_ERROR([PAM development files not found.]) -- fi]) -- - AC_ARG_ENABLE(console-helper, - AS_HELP_STRING([--enable-console-helper], - [Enable PAM console helper @<:@default=auto@:>@]),, -@@ -263,7 +257,15 @@ AC_ARG_WITH(tcp-wrappers, - [Use TCP Wrappers @<:@default=auto@:>@]),, - with_tcp_wrappers=auto) - -+AC_ARG_WITH(console-kit, -+ AS_HELP_STRING([--with-console-kit], -+ [Add ConsoleKit support @<:@default=auto@:>@]),, -+ with_console_kit=no) - -+AC_ARG_WITH(systemd, -+ AS_HELP_STRING([--with-systemd], -+ [Add systemd support @<:@default=auto@:>@]), -+ [with_systemd=$withval], [with_systemd=auto]) - AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], - [Directory for systemd service files]), -@@ -548,6 +550,8 @@ fi - if test "x$supports_pam_extensions" = "xyes" ; then - AM_CONDITIONAL(SUPPORTS_PAM_EXTENSIONS, true) - AC_DEFINE(SUPPORTS_PAM_EXTENSIONS, 1, [Define if PAM supports GDMs custom extensions]) -+else -+ AM_CONDITIONAL(SUPPORTS_PAM_EXTENSIONS, false) - fi - - AC_CHECK_LIB(keyutils, keyctl_read, [ -@@ -655,14 +659,8 @@ dnl -------------------------------------------------- - dnl - Check for utmp stuff - dnl --------------------------------------------------------------------------- - --AC_CHECK_HEADERS(utmp.h utmpx.h libutil.h sys/param.h) --AC_CHECK_FUNCS([getutxent updwtmpx updwtmp]) --AC_CHECK_LIB(util, login, [ -- AC_DEFINE(HAVE_LOGIN, 1, [Define if have login]) -- EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ]) --AC_CHECK_LIB(util, logout, [ -- AC_DEFINE(HAVE_LOGOUT, 1, [Define if have logout]) -- EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ]) -+AC_CHECK_HEADERS(utmp.h utmpx.h util.h sys/param.h) -+AC_CHECK_FUNCS([getutxent getttyent updwtmpx updwtmp]) - AC_CHECK_LIB(util, logwtmp, [ - AC_DEFINE(HAVE_LOGWTMP, 1, [Define if have logwtmp]) - EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ]) -@@ -911,12 +909,42 @@ AC_SUBST(XINERAMA_LIBS) - CPPFLAGS="$xinerama_save_cppflags" - - dnl --------------------------------------------------------------------------- -+dnl - Check for ConsoleKit support -+dnl --------------------------------------------------------------------------- -+ -+use_console_kit=no -+if test "x$with_console_kit" != "xno" ; then -+ use_console_kit=yes -+ AC_DEFINE(WITH_CONSOLE_KIT, 1, [Define to enable ConsoleKit support]) -+fi -+AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes) -+AC_SUBST(WITH_CONSOLE_KIT) -+ -+dnl --------------------------------------------------------------------------- - dnl - Check for systemd support - dnl --------------------------------------------------------------------------- - - PKG_CHECK_MODULES(SYSTEMD, -- [libsystemd]) -+ [libsystemd-login >= 186 libsystemd-daemon], -+ [have_systemd=yes], [have_systemd=no]) - -+if test "x$with_systemd" = "xauto" ; then -+ if test x$have_systemd = xno ; then -+ use_systemd=no -+ else -+ use_systemd=yes -+ fi -+else -+ use_systemd="$with_systemd" -+fi -+ -+if test "x$use_systemd" != "xno" ; then -+ if test "x$have_systemd" = "xno"; then -+ AC_MSG_ERROR([Systemd support explicitly required, but systemd not found]) -+ fi -+ -+ AC_DEFINE(WITH_SYSTEMD, 1, [Define to enable systemd support]) -+fi - AC_SUBST(SYSTEMD_CFLAGS) - AC_SUBST(SYSTEMD_LIBS) - -@@ -1111,6 +1139,14 @@ fi - AC_SUBST(GDM_CUSTOM_CONF) - AC_SUBST(GDM_OLD_CONF, '${gdmconfdir}/gdm.conf') - -+AC_ARG_WITH(consolekit-directory, -+ [AC_HELP_STRING([--with-consolekit-directory], -+ [Specify the directory of ck-get-x11-display-device @<:@default=libexecdir@:>@])],, -+ [with_consolekit_directory="\${libexecdir}"]) -+ -+CONSOLEKIT_DIR=$with_consolekit_directory -+AC_SUBST(CONSOLEKIT_DIR) -+ - AC_ARG_WITH(gnome-settings-daemon-directory, - [AC_HELP_STRING([--with-gnome-settings-daemon-directory], - [Specify the directory of gnome-settings-daemon used by the chooser @<:@default=libexecdir@:>@])],, -@@ -1601,6 +1637,7 @@ echo " - dmconfdir: ${dmconfdir} - localstatedir: ${localstatedir} - datadir: ${datadir} -+ consolekit location: ${with_consolekit_directory} - gnome-settings-daemon location: ${with_gnome_settings_daemon_directory} - gnome-session-check-accel location: ${with_check_accelerated_directory} - source code location: ${srcdir} -@@ -1631,6 +1668,8 @@ echo \ - " Xinerama support: ${XINERAMA_SUPPORT} - XDMCP support: ${XDMCP_SUPPORT} - SELinux support: ${use_selinux} -+ ConsoleKit support: ${use_console_kit} -+ systemd support: ${use_systemd} - systemd unit dir: ${with_systemdsystemunitdir} - plymouth support: ${use_plymouth} - wayland support: ${enable_wayland_support} -@@ -1639,3 +1678,4 @@ echo \ - Enable documentation: ${enable_documentation} - Install GDM's Xsession: ${enable_gdm_xsession} - " -+ diff --git a/x11/gdm/files/daemon_Makefile.am b/x11/gdm/files/daemon_Makefile.am deleted file mode 100644 index 72d55fb06926..000000000000 --- a/x11/gdm/files/daemon_Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ ---- daemon/Makefile.am.orig 2017-10-30 16:21:02.000000000 +0100 -+++ daemon/Makefile.am 2018-01-14 12:30:11.501517000 +0100 -@@ -21,6 +21,7 @@ AM_CPPFLAGS = \ - -DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\" \ - -DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \ - -DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \ -+ -DCONSOLEKIT_DIR=\"$(CONSOLEKIT_DIR)\" \ - $(DISABLE_DEPRECATED_CFLAGS) \ - $(DAEMON_CFLAGS) \ - $(XLIB_CFLAGS) \ -@@ -267,6 +268,11 @@ EXTRA_gdm_SOURCES = \ - $(XDMCP_SOURCES) \ - $(NULL) - -+CONSOLE_KIT_SOURCES = \ -+ $(NULL) -+ -+EXTRA_gdm_SOURCES += $(CONSOLE_KIT_SOURCES) -+ - gdm_LDADD = \ - $(top_builddir)/common/libgdmcommon.la \ - $(XLIB_LIBS) \ -@@ -277,6 +283,10 @@ gdm_LDADD = \ - $(JOURNALD_LIBS) \ - $(EXTRA_DAEMON_LIBS) \ - $(NULL) -+ -+if WITH_CONSOLE_KIT -+gdm_SOURCES += $(CONSOLE_KIT_SOURCES) -+endif - - CLEANFILES = \ - gdm-display-glue.c \ diff --git a/x11/gdm/files/gdm-autologin.in b/x11/gdm/files/gdm-autologin.in index 9e89fd1fcbbb..78a423679762 100644 --- a/x11/gdm/files/gdm-autologin.in +++ b/x11/gdm/files/gdm-autologin.in @@ -4,8 +4,8 @@ auth required pam_permit.so -auth optional /usr/local/lib/pam_ck_connector.so -auth optional /usr/local/lib/pam_gnome_keyring.so +auth optional %%PREFIX%%/lib/pam_ck_connector.so +auth optional %%PREFIX%%/lib/pam_gnome_keyring.so account required pam_nologin.so account include system @@ -13,4 +13,4 @@ account include system password include system session include system -session optional /usr/local/lib/pam_gnome_keyring.so auto_start +session optional %%PREFIX%%/lib/pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/gdm-password.in b/x11/gdm/files/gdm-password.in index 3b7b48e2e9b9..65bfa040422f 100644 --- a/x11/gdm/files/gdm-password.in +++ b/x11/gdm/files/gdm-password.in @@ -4,8 +4,8 @@ auth include system -auth optional /usr/local/lib/pam_ck_connector.so -auth optional /usr/local/lib/pam_gnome_keyring.so +auth optional %%PREFIX%%/lib/pam_ck_connector.so +auth optional %%PREFIX%%/lib/pam_gnome_keyring.so account required pam_nologin.so account include system @@ -13,4 +13,4 @@ account include system password include system session include system -session optional /usr/local/lib/pam_gnome_keyring.so auto_start +session optional %%PREFIX%%/lib/pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/gdm.in b/x11/gdm/files/gdm.in index 5a0fcc2d76a9..16b6c4aeae13 100644 --- a/x11/gdm/files/gdm.in +++ b/x11/gdm/files/gdm.in @@ -32,9 +32,9 @@ gdm_start() fi echo "Starting ${name}." - # we need to remove locking files under $gdm_home/.cache/gnome-shell/ + # we need to remove locking files under /var/cache/gdm/.cache/gnome-shell/ # until XDG_RUNTIME_DIR can be set and used - rm -fr %%PREFIX%%/etc/gdm/home/.cache/gnome-shell/runtime-state* + rm -fr /var/cache/gdm/.cache/gnome-shell/runtime-state* # make sure there is no pam configuration for gdm service in base system if ! checkyesno gdm_preserve_base_pam_conf && [ -f /etc/pam.d/gdm ]; then diff --git a/x11/gdm/files/patch-build-aux_find-x-server.sh b/x11/gdm/files/patch-build-aux_find-x-server.sh new file mode 100644 index 000000000000..ca3f15693fe5 --- /dev/null +++ b/x11/gdm/files/patch-build-aux_find-x-server.sh @@ -0,0 +1,13 @@ +--- build-aux/find-x-server.sh.orig 2023-05-05 18:12:53 UTC ++++ build-aux/find-x-server.sh +@@ -29,6 +29,10 @@ elif test -x /usr/openwin/bin/Xsun; then + echo "/usr/openwin/bin/Xsun" + elif test -x /opt/X11R6/bin/X; then + echo "/opt/X11R6/bin/X" ++elif test -x /usr/local/bin/Xorg; then ++ echo "/usr/local/bin/Xorg" ++elif test -x /usr/local/bin/X; then ++ echo "/usr/local/bin/X" + else + echo "" + fi diff --git a/x11/gdm/files/patch-common_gdm-common.c b/x11/gdm/files/patch-common_gdm-common.c index cb4900ae4994..1ee91d606f3e 100644 --- a/x11/gdm/files/patch-common_gdm-common.c +++ b/x11/gdm/files/patch-common_gdm-common.c @@ -1,488 +1,43 @@ ---- common/gdm-common.c.orig 2022-01-12 14:15:56 UTC +--- common/gdm-common.c.orig 2023-09-14 15:27:04 UTC +++ common/gdm-common.c -@@ -36,7 +36,9 @@ +@@ -36,8 +36,13 @@ #include "gdm-common.h" -+#ifdef WITH_SYSTEMD ++#if defined(WITH_SYSTEMD) #include <systemd/sd-login.h> ++#elif defined(WITH_CONSOLE_KIT) ++#include <ConsoleKit/sd-login.h> +#endif ++ #define GDM_DBUS_NAME "org.gnome.DisplayManager" #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH "/org/gnome/DisplayManager/LocalDisplayFactory" -@@ -352,6 +354,412 @@ create_transient_display (GDBusConnection *connection, - return TRUE; - } + #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_INTERFACE "org.gnome.DisplayManager.LocalDisplayFactory" +@@ -368,15 +373,22 @@ gdm_activate_session_by_id (GDBusConnection *connectio + g_return_val_if_fail (session_id != NULL, FALSE); -+#ifdef WITH_CONSOLE_KIT -+int -+sd_seat_can_graphical(const char *seat) -+{ -+ // XXX -+ return 1; -+} -+ -+int -+sd_session_get_service(const char *session, -+ char **service) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetSessionService", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session service: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(s)", &value); -+ g_variant_unref (reply); -+ -+ *service = g_strdup (value); -+ -+ return 0; -+} -+ -+int -+sd_session_get_uid(const char *session, -+ uid_t *uid) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ g_autoptr(GDBusConnection) connection = NULL; -+ uid_t local_uid; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetUnixUser", -+ NULL, -+ G_VARIANT_TYPE ("(u)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to get session for unix service: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(u)", &local_uid); -+ g_variant_unref (reply); -+ -+ *uid = local_uid; -+ -+ return 0; -+} -+ -+int -+sd_seat_get_sessions(const char *seat, -+ char ***sessions, -+ uid_t **uid, -+ unsigned int *n_uids) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ GVariantIter *iter; -+ gchar *value = NULL; -+ glong nchild; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (seat == NULL || !g_variant_is_object_path (seat)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat, -+ CK_SEAT_INTERFACE, -+ "GetSessions", -+ NULL, -+ G_VARIANT_TYPE ("(ao)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error->message); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(ao)", &iter); -+ g_variant_unref (reply); -+ -+ nchild = g_variant_iter_n_children(iter); -+ *sessions = calloc(nchild, sizeof(gchar *)); -+ if (*sessions == NULL) { -+ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); -+ return -ENOMEM; -+ } -+ -+ while (g_variant_iter_next (iter, "o", &value)) { -+ (*sessions)[nchild - 1] = g_strdup(value); -+ } -+ (*sessions)[nchild] = NULL; -+ -+ g_variant_iter_free (iter); -+ -+ return 0; -+} -+ -+int -+sd_session_get_seat(const char *session, -+ char **seat) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetSeatId", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine seat: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(o)", &value); -+ g_variant_unref (reply); -+ -+ *seat = g_strdup(value); -+ -+ return 0; -+} -+ -+int -+sd_pid_get_session(pid_t pid, char **session) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ CK_MANAGER_PATH, -+ CK_MANAGER_INTERFACE, -+ "GetSessionForUnixProcess", -+ g_variant_new ("(u)", pid), -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(o)", &value); -+ g_variant_unref (reply); -+ -+ *session = g_strdup (value); -+ -+ return 0; -+} -+ -+int -+sd_session_get_type(const char *session, char **type) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetSessionType", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session type: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(s)", &value); -+ g_variant_unref (reply); -+ -+ *type = g_strdup (value); -+ -+ return 0; -+} -+ -+int -+sd_session_get_class(const char *session, char **class) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const gchar *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetSessionClass", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session class: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(s)", &value); -+ g_variant_unref (reply); -+ -+ *class = g_strdup(value); -+ -+ return 0; -+} -+ -+int -+sd_session_get_state(const char *session, char **state) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ if (session == NULL || !g_variant_is_object_path (session)) -+ return -ENXIO; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session, -+ CK_SESSION_INTERFACE, -+ "GetSessionState", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session state: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(s)", &value); -+ g_variant_unref (reply); -+ -+ *state = g_strdup (value); -+ -+ return 0; -+} -+ -+int -+sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ GVariantIter *iter; -+ gchar *value = NULL; -+ glong nchild; -+ g_autoptr(GDBusConnection) connection = NULL; -+ -+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); -+ if (connection == NULL) { -+ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); -+ return -ENXIO; -+ } -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ CK_MANAGER_PATH, -+ CK_MANAGER_INTERFACE, -+ "GetSessionsForUnixUser", -+ g_variant_new ("(u)", uid), -+ G_VARIANT_TYPE ("(ao)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return -ENXIO; -+ } -+ -+ g_variant_get (reply, "(ao)", &iter); -+ g_variant_unref (reply); -+ -+ nchild = g_variant_iter_n_children(iter); -+ *sessions = calloc(nchild, sizeof(gchar *)); -+ if (*sessions == NULL) { -+ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); -+ return -ENOMEM; -+ } -+ -+ while (g_variant_iter_next (iter, "o", &value)) { -+ (*sessions)[nchild - 1] = g_strdup(value); -+ } -+ (*sessions)[nchild] = NULL; -+ -+ g_variant_iter_free (iter); -+ -+ return 0; -+} -+#endif -+ - gboolean - gdm_activate_session_by_id (GDBusConnection *connection, - const char *seat_id, -@@ -360,6 +768,7 @@ gdm_activate_session_by_id (GDBusConnection *connectio - GError *local_error = NULL; - GVariant *reply; - -+#if defined(WITH_SYSTEMD) reply = g_dbus_connection_call_sync (connection, ++#if defined(WITH_SYSTEMD) "org.freedesktop.login1", "/org/freedesktop/login1", -@@ -370,7 +779,41 @@ gdm_activate_session_by_id (GDBusConnection *connectio + "org.freedesktop.login1.Manager", ++#elif defined(WITH_CONSOLE_KIT) ++ "org.freedesktop.ConsoleKit", ++ "/org/freedesktop/ConsoleKit/Manager", ++ "org.freedesktop.ConsoleKit.Manager", ++#endif + "ActivateSessionOnSeat", + g_variant_new ("(ss)", session_id, seat_id), + NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, &local_error); -+#elif defined(WITH_CONSOLE_KIT) -+ gboolean ret; + cancellable, &local_error); + -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "CanActivateSessions", -+ NULL, -+ G_VARIANT_TYPE ("(b)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); if (reply == NULL) { -+ g_warning ("Unable to determine if can activate sessions: %s", local_error ? local_error->message : ""); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(b)", &ret); -+ if (ret != TRUE) -+ return ret; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "ActivateSession", -+ g_variant_new ("(o)", session_id), -+ NULL, -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+#endif -+ if (reply == NULL) { g_warning ("Unable to activate session: %s", local_error->message); g_error_free (local_error); - return FALSE; -@@ -521,7 +964,7 @@ goto_login_session (GDBusConnection *connection, - } - } - -- if (! ret && g_strcmp0 (seat_id, "seat0") == 0) { -+ if (! ret && g_strcmp0 (seat_id, SEAT_ID) == 0) { - res = create_transient_display (connection, error); - if (res) { - ret = TRUE; -@@ -907,7 +1350,9 @@ gdm_find_display_session (GPid pid, +@@ -916,7 +928,9 @@ gdm_find_display_session (GPid pid, return TRUE; } else { diff --git a/x11/gdm/files/patch-common_gdm-common.h b/x11/gdm/files/patch-common_gdm-common.h index cfd935a1119f..d818a3595b6a 100644 --- a/x11/gdm/files/patch-common_gdm-common.h +++ b/x11/gdm/files/patch-common_gdm-common.h @@ -1,12 +1,10 @@ ---- common/gdm-common.h.orig 2022-01-12 14:15:56 UTC +--- common/gdm-common.h.orig 2023-09-14 15:27:04 UTC +++ common/gdm-common.h -@@ -29,6 +29,50 @@ +@@ -29,6 +29,17 @@ #define REGISTER_SESSION_TIMEOUT 10 -+#if defined(WITH_SYSTEMD) -+#define SEAT_ID "seat0" -+#elif defined(WITH_CONSOLE_KIT) ++#if defined(WITH_CONSOLE_KIT) +#define CK_NAME "org.freedesktop.ConsoleKit" +#define CK_PATH "/org/freedesktop/ConsoleKit" +#define CK_INTERFACE "org.freedesktop.ConsoleKit" @@ -15,37 +13,6 @@ +#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" +#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" +#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" -+#define SEAT_ID "/org/freedesktop/ConsoleKit/Seat1" -+ -+int -+sd_pid_get_session(pid_t pid, char **session); -+ -+int -+sd_session_get_uid(const char *session, -+ uid_t *uid); -+ -+int -+sd_session_get_class(const char *session, char **class); -+ -+int -+sd_session_get_seat(const char *session, -+ char **seat); -+ -+int -+sd_seat_get_sessions(const char *seat, -+ char ***sessions, -+ uid_t **uid, -+ unsigned int *n_uids); -+ -+int -+sd_session_get_state(const char *session, char **state); -+ -+int -+sd_session_get_service(const char *session, -+ char **service); -+ -+int -+sd_seat_can_graphical(const char *seat); +#endif + #define VE_IGNORE_EINTR(expr) \ diff --git a/x11/gdm/files/patch-common_gdm-log.c b/x11/gdm/files/patch-common_gdm-log.c index c3e7b623501f..eac4744a400d 100644 --- a/x11/gdm/files/patch-common_gdm-log.c +++ b/x11/gdm/files/patch-common_gdm-log.c @@ -1,4 +1,4 @@ ---- common/gdm-log.c.orig 2022-01-12 14:15:56 UTC +--- common/gdm-log.c.orig 2023-03-20 15:42:37 UTC +++ common/gdm-log.c @@ -30,7 +30,9 @@ #include <unistd.h> diff --git a/x11/gdm/files/patch-daemon_gdm-display-access-file.c b/x11/gdm/files/patch-daemon_gdm-display-access-file.c index 78a78f5096b4..a651d22b2002 100644 --- a/x11/gdm/files/patch-daemon_gdm-display-access-file.c +++ b/x11/gdm/files/patch-daemon_gdm-display-access-file.c @@ -1,19 +1,12 @@ ---- daemon/gdm-display-access-file.c.orig 2022-01-12 14:15:56 UTC +--- daemon/gdm-display-access-file.c.orig 2023-09-14 15:27:04 UTC +++ daemon/gdm-display-access-file.c -@@ -337,9 +337,18 @@ _create_xauth_file_for_user (const char *username, +@@ -337,9 +337,11 @@ _create_xauth_file_for_user (const char *username, g_debug ("GdmDisplayAccessFile: creating %s", auth_filename); /* mode 00600 */ errno = 0; - fd = g_open (auth_filename, - O_RDWR | O_CREAT | O_EXCL | O_BINARY, - S_IRUSR | S_IWUSR); -+#if defined(__OpenBSD__) -+ if (uid == 676) { -+ fd = g_open (auth_filename, -+ O_RDWR | O_CREAT | O_EXCL | O_BINARY, -+ S_IRUSR | S_IWUSR | S_IRGRP); -+ } else -+#endif + { + fd = g_open (auth_filename, + O_RDWR | O_CREAT | O_EXCL | O_BINARY, @@ -22,15 +15,15 @@ if (fd < 0) { g_set_error (error, -@@ -441,9 +450,9 @@ _get_auth_info_for_display (GdmDisplayAccessFile *file +@@ -429,9 +431,9 @@ _get_auth_info_for_display (GdmDisplayAccessFile *file * * https://bugs.freedesktop.org/show_bug.cgi?id=43425 */ - char localhost[HOST_NAME_MAX + 1] = ""; -+ char localhost[256] = ""; ++ char localhost[_POSIX_HOST_NAME_MAX + 1] = ""; *family = FamilyLocal; - if (gethostname (localhost, HOST_NAME_MAX) == 0) { -+ if (gethostname (localhost, 255) == 0) { ++ if (gethostname (localhost, _POSIX_HOST_NAME_MAX) == 0) { *address = g_strdup (localhost); } else { *address = g_strdup ("localhost"); diff --git a/x11/gdm/files/patch-daemon_gdm-display.c b/x11/gdm/files/patch-daemon_gdm-display.c deleted file mode 100644 index 152072231efa..000000000000 --- a/x11/gdm/files/patch-daemon_gdm-display.c +++ /dev/null @@ -1,16 +0,0 @@ ---- daemon/gdm-display.c.orig 2022-01-12 14:15:56 UTC -+++ daemon/gdm-display.c -@@ -245,8 +245,13 @@ setup_xhost_auth (XHostAddress *host_entr - host_entries[1].address = "localuser\0" GDM_USERNAME; - host_entries[1].length = sizeof ("localuser\0" GDM_USERNAME); - host_entries[2].family = FamilyServerInterpreted; -+#if defined(__OpenBSD__) -+ host_entries[2].address = "localuser\0_gnome-initial-setup"; -+ host_entries[2].length = sizeof ("localuser\0_gnome-initial-setup"); -+#else - host_entries[2].address = "localuser\0gnome-initial-setup"; - host_entries[2].length = sizeof ("localuser\0gnome-initial-setup"); -+#endif - } - - gboolean diff --git a/x11/gdm/files/patch-daemon_gdm-launch-environment.c b/x11/gdm/files/patch-daemon_gdm-launch-environment.c new file mode 100644 index 000000000000..79068d6db067 --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-launch-environment.c @@ -0,0 +1,21 @@ +--- daemon/gdm-launch-environment.c.orig 2023-09-14 15:27:04 UTC ++++ daemon/gdm-launch-environment.c +@@ -140,18 +140,12 @@ build_launch_environment (GdmLaunchEnvironment *launch + "GI_TYPELIB_PATH", + "LANG", + "LANGUAGE", +- "LC_ADDRESS", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", +- "LC_IDENTIFICATION", +- "LC_MEASUREMENT", + "LC_MESSAGES", + "LC_MONETARY", +- "LC_NAME", + "LC_NUMERIC", +- "LC_PAPER", +- "LC_TELEPHONE", + "LC_TIME", + "LD_LIBRARY_PATH", + "PATH", diff --git a/x11/gdm/files/patch-daemon_gdm-local-display-factory.c b/x11/gdm/files/patch-daemon_gdm-local-display-factory.c index 5219f30fc618..07f024001656 100644 --- a/x11/gdm/files/patch-daemon_gdm-local-display-factory.c +++ b/x11/gdm/files/patch-daemon_gdm-local-display-factory.c @@ -1,20 +1,22 @@ ---- daemon/gdm-local-display-factory.c.orig 2022-03-21 18:12:40 UTC +--- daemon/gdm-local-display-factory.c.orig 2024-09-16 13:28:26 UTC +++ daemon/gdm-local-display-factory.c -@@ -29,10 +29,12 @@ +@@ -28,11 +28,15 @@ + #include <glib-object.h> #include <gio/gio.h> ++#ifdef WITH_SYSTEMD #ifdef HAVE_UDEV --#include <gudev/gudev.h> -+#undef HAVE_UDEV + #include <gudev/gudev.h> #endif -+#ifdef WITH_SYSTEMD #include <systemd/sd-login.h> ++#elif defined(WITH_CONSOLE_KIT) ++#include <ConsoleKit/sd-login.h> +#endif #include "gdm-common.h" #include "gdm-manager.h" -@@ -68,8 +70,10 @@ struct _GdmLocalDisplayFactory +@@ -68,8 +72,10 @@ struct _GdmLocalDisplayFactory /* FIXME: this needs to be per seat? */ guint num_failures; @@ -23,9 +25,9 @@ guint seat_removed_id; +#endif guint seat_properties_changed_id; + guint seat_attention_key; - gboolean seat0_has_platform_graphics; -@@ -106,9 +110,11 @@ static gpointer local_display_factory_object = NULL; +@@ -108,9 +114,11 @@ static gpointer local_display_factory_object = NULL; static gboolean gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory); static gpointer local_display_factory_object = NULL; @@ -37,27 +39,7 @@ G_DEFINE_TYPE (GdmLocalDisplayFactory, gdm_local_display_factory, GDM_TYPE_DISPLAY_FACTORY) -@@ -245,9 +251,9 @@ struct GdmDisplayServerConfiguration { - const char *session_type; - } display_server_configuration[] = { - #ifdef ENABLE_WAYLAND_SUPPORT -- { "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/bin/Xwayland", "wayland" }, -+ { "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/local/bin/Xwayland", "wayland" }, - #endif -- { "xorg", GDM_KEY_XORG_ENABLE, "/usr/bin/Xorg", "x11" }, -+ { "xorg", GDM_KEY_XORG_ENABLE, X_SERVER, "x11" }, - { NULL, NULL, NULL }, - }; - -@@ -373,7 +379,6 @@ gdm_local_display_factory_create_transient_display (Gd - gboolean ret; - GdmDisplay *display = NULL; - gboolean is_initial = FALSE; -- const char *session_type; - g_autofree gchar *preferred_display_server = NULL; - - g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE); -@@ -451,6 +456,7 @@ gdm_local_display_factory_create_transient_display (Gd +@@ -474,6 +482,7 @@ gdm_local_display_factory_create_transient_display (Gd return ret; } @@ -65,7 +47,7 @@ static void finish_display_on_seat_if_waiting (GdmDisplayStore *display_store, GdmDisplay *display, -@@ -505,6 +511,7 @@ on_session_registered_cb (GObject *gobject, +@@ -528,6 +537,7 @@ on_session_registered_cb (GObject *gobject, finish_waiting_displays_on_seat (factory, "seat0"); } @@ -73,51 +55,58 @@ static void on_display_status_changed (GdmDisplay *display, -@@ -552,7 +559,7 @@ on_display_status_changed (GdmDisplay *dis - * if there isn't one. +@@ -560,7 +570,9 @@ on_display_status_changed (GdmDisplay *dis + "session-id", &session_id, + NULL); + ++#ifdef WITH_SYSTEMD + sd_seat_get_active (seat_id, &seat_active_session, NULL); ++#endif + + status = gdm_display_get_status (display); + +@@ -578,12 +590,16 @@ on_display_status_changed (GdmDisplay *dis + * screen when the user logs out. */ if (is_local && -- (g_strcmp0 (session_class, "greeter") != 0 || factory->active_vt == GDM_INITIAL_VT)) { ++#ifdef WITH_SYSTEMD + ((g_strcmp0 (session_class, "greeter") != 0 && + (!seat_active_session || g_strcmp0(session_id, seat_active_session) == 0)) || + #if defined(ENABLE_USER_DISPLAY_SERVER) + (g_strcmp0 (seat_id, "seat0") == 0 && factory->active_vt == GDM_INITIAL_VT) || + #endif + g_strcmp0 (seat_id, "seat0") != 0)) { ++#else + (g_strcmp0 (session_class, "greeter") != 0)) { ++#endif /* reset num failures */ factory->num_failures = 0; -@@ -741,7 +748,9 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto +@@ -818,12 +834,15 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + g_auto (GStrv) session_types = NULL; const char *legacy_session_types[] = { "x11", NULL }; - GdmDisplayStore *store; GdmDisplay *display = NULL; +#ifdef WITH_SYSTEMD g_autofree char *login_session_id = NULL; +#endif - gboolean wayland_enabled = FALSE, xorg_enabled = FALSE; g_autofree gchar *preferred_display_server = NULL; - gboolean falling_back = FALSE; -@@ -781,7 +790,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto - seat_supports_graphics = FALSE; - } + gboolean waiting_on_udev = FALSE; -- if (g_strcmp0 (seat_id, "seat0") == 0) { -+ if (g_strcmp0 (seat_id, SEAT_ID) == 0) { - is_seat0 = TRUE; - - falling_back = factory->num_failures > 0; -@@ -869,6 +878,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto - return; - } + g_debug ("GdmLocalDisplayFactory: display for seat %s requested", seat_id); +#ifdef WITH_SYSTEMD /* If we already have a login window, switch to it */ if (gdm_get_login_window_session_id (seat_id, &login_session_id)) { GdmDisplay *display; -@@ -886,6 +896,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto +@@ -843,6 +862,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto return; } } +#endif - g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id); + preferred_display_server = get_preferred_display_server (factory); -@@ -929,6 +940,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto +@@ -993,6 +1013,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto return; } @@ -125,7 +114,7 @@ static void delete_display (GdmLocalDisplayFactory *factory, const char *seat_id) { -@@ -940,6 +952,7 @@ delete_display (GdmLocalDisplayFactory *factory, +@@ -1004,6 +1025,7 @@ delete_display (GdmLocalDisplayFactory *factory, store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); gdm_display_store_foreach_remove (store, lookup_by_seat_id, (gpointer) seat_id); } @@ -133,16 +122,15 @@ static gboolean gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory) -@@ -951,6 +964,8 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF +@@ -1015,6 +1037,7 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF const char *seat; g_debug ("GdmLocalDisplayFactory: enumerating seats from logind"); -+ +#ifdef WITH_SYSTEMD result = g_dbus_connection_call_sync (factory->connection, "org.freedesktop.login1", "/org/freedesktop/login1", -@@ -961,6 +976,18 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF +@@ -1025,6 +1048,18 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); @@ -161,15 +149,15 @@ if (!result) { g_warning ("GdmLocalDisplayFactory: Failed to issue method call: %s", error->message); -@@ -980,6 +1007,7 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF +@@ -1044,6 +1079,7 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF return TRUE; } +#ifdef WITH_SYSTEMD static void - on_seat_new (GDBusConnection *connection, - const gchar *sender_name, -@@ -1093,6 +1121,7 @@ lookup_by_tty (const char *id, + on_seat_activate_greeter (GDBusConnection *connection, + const gchar *sender_name, +@@ -1177,6 +1213,7 @@ lookup_by_tty (const char *id, return g_strcmp0 (tty_to_check, tty_to_find) == 0; } @@ -177,15 +165,15 @@ #if defined(ENABLE_USER_DISPLAY_SERVER) static void -@@ -1295,6 +1324,7 @@ on_uevent (GUdevClient *client, +@@ -1354,6 +1391,7 @@ on_vt_changed (GIOChannel *source, } #endif +#ifdef WITH_SYSTEMD + #ifdef HAVE_UDEV static void - gdm_local_display_factory_start_monitor (GdmLocalDisplayFactory *factory) - { -@@ -1352,10 +1382,12 @@ gdm_local_display_factory_start_monitor (GdmLocalDispl + on_uevent (GUdevClient *client, +@@ -1444,10 +1482,12 @@ gdm_local_display_factory_start_monitor (GdmLocalDispl } #endif } @@ -194,19 +182,19 @@ static void gdm_local_display_factory_stop_monitor (GdmLocalDisplayFactory *factory) { -+#ifdef HAVE_UDEV ++#ifdef WITH_SYSTEMD if (factory->uevent_handler_id) { g_signal_handler_disconnect (factory->gudev_client, factory->uevent_handler_id); factory->uevent_handler_id = 0; -@@ -1387,6 +1419,7 @@ gdm_local_display_factory_stop_monitor (GdmLocalDispla - factory->wait_to_finish_timeout_id = 0; - } +@@ -1478,6 +1518,7 @@ gdm_local_display_factory_stop_monitor (GdmLocalDispla + g_clear_handle_id (&factory->active_vt_watch_id, g_source_remove); + g_clear_handle_id (&factory->wait_to_finish_timeout_id, g_source_remove); #endif +#endif } static void -@@ -1441,7 +1474,9 @@ gdm_local_display_factory_start (GdmDisplayFactory *ba +@@ -1532,7 +1573,9 @@ gdm_local_display_factory_start (GdmDisplayFactory *ba factory, 0); diff --git a/x11/gdm/files/patch-daemon_gdm-manager.c b/x11/gdm/files/patch-daemon_gdm-manager.c index 3082318a5166..94b5b2c6d8d4 100644 --- a/x11/gdm/files/patch-daemon_gdm-manager.c +++ b/x11/gdm/files/patch-daemon_gdm-manager.c @@ -1,38 +1,31 @@ ---- daemon/gdm-manager.c.orig 2022-01-12 14:15:56 UTC +--- daemon/gdm-manager.c.orig 2024-05-29 15:50:27 UTC +++ daemon/gdm-manager.c -@@ -36,7 +36,9 @@ +@@ -36,7 +36,11 @@ #include <act/act-user-manager.h> +#ifdef WITH_SYSTEMD #include <systemd/sd-login.h> ++#elif defined(WITH_CONSOLE_KIT) ++#include <ConsoleKit/sd-login.h> +#endif #include "gdm-common.h" -@@ -61,7 +63,7 @@ - #define GDM_MANAGER_PATH GDM_DBUS_PATH "/Manager" - #define GDM_MANAGER_DISPLAYS_PATH GDM_DBUS_PATH "/Displays" - --#define INITIAL_SETUP_USERNAME "gnome-initial-setup" -+#define INITIAL_SETUP_USERNAME "_gnome-initial-setup" - #define ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT GDM_RUN_DIR "/gdm.ran-initial-setup" - - typedef struct -@@ -304,6 +306,7 @@ session_unlock (GdmManager *manager, +@@ -307,6 +311,7 @@ session_unlock (GdmManager *manager, g_debug ("Unlocking session %s", ssid); +#if defined(WITH_SYSTEMD) - reply = g_dbus_connection_call_sync (manager->priv->connection, + reply = g_dbus_connection_call_sync (manager->connection, "org.freedesktop.login1", "/org/freedesktop/login1", -@@ -321,6 +324,25 @@ session_unlock (GdmManager *manager, +@@ -324,6 +329,25 @@ session_unlock (GdmManager *manager, g_error_free (error); return FALSE; } +#elif defined(WITH_CONSOLE_KIT) -+ reply = g_dbus_connection_call_sync (manager->priv->connection, ++ reply = g_dbus_connection_call_sync (manager->connection, + CK_NAME, + ssid, + CK_SESSION_INTERFACE, @@ -53,7 +46,43 @@ g_variant_unref (reply); -@@ -436,6 +458,7 @@ static char * +@@ -380,6 +404,7 @@ is_remote_session (GdmManager *self, + const char *session_id, + GError **error) + { ++#ifdef WITH_SYSTEMD + int ret; + + ret = sd_session_is_remote (session_id); +@@ -393,6 +418,27 @@ is_remote_session (GdmManager *self, + } + + return ret != FALSE; ++#elif defined(WITH_CONSOLE_KIT) ++ char *seat = NULL; ++ int ret; ++ gboolean is_remote; ++ ++ ret = sd_session_get_seat (session_id, &seat); ++ ++ if (ret < 0 && ret != -ENXIO) { ++ g_debug ("GdmManager: Error while retrieving seat for session %s: %s", ++ session_id, g_strerror (-ret)); ++ } ++ ++ if (seat != NULL) { ++ is_remote = FALSE; ++ free (seat); ++ } else { ++ is_remote = TRUE; ++ } ++ ++ return is_remote; ++#endif + } + + static char * +@@ -427,6 +473,7 @@ get_tty_for_session_id (const char *session_id, get_tty_for_session_id (const char *session_id, GError **error) { @@ -61,7 +90,7 @@ int ret; char *tty, *out_tty; -@@ -457,6 +480,9 @@ get_tty_for_session_id (const char *session_id, +@@ -448,6 +495,9 @@ get_tty_for_session_id (const char *session_id, } return out_tty; @@ -71,32 +100,7 @@ } static void -@@ -609,6 +635,7 @@ switch_to_compatible_user_session (GdmManager *manager - - if (existing_session != NULL) { - ssid_to_activate = gdm_session_get_session_id (existing_session); -+#ifndef __FreeBSD__ - if (seat_id != NULL) { - res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate); - if (! res) { -@@ -616,6 +643,7 @@ switch_to_compatible_user_session (GdmManager *manager - goto out; - } - } -+#endif - - res = session_unlock (manager, ssid_to_activate); - if (!res) { -@@ -1204,7 +1232,7 @@ display_is_on_seat0 (GdmDisplay *display) - - g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); - -- if (g_strcmp0 (seat_id, "seat0") != 0) { -+ if (g_strcmp0 (seat_id, SEAT_ID) != 0) { - is_on_seat0 = FALSE; - } - -@@ -2019,12 +2047,58 @@ on_user_session_died (GdmSession *session, +@@ -2101,12 +2151,58 @@ on_user_session_died (GdmSession *session, remove_user_session (manager, session); } diff --git a/x11/gdm/files/patch-daemon_gdm-server.c b/x11/gdm/files/patch-daemon_gdm-server.c index 136fc2bc9115..f78a3e0fb03b 100644 --- a/x11/gdm/files/patch-daemon_gdm-server.c +++ b/x11/gdm/files/patch-daemon_gdm-server.c @@ -1,4 +1,4 @@ ---- daemon/gdm-server.c.orig 2022-01-28 21:55:35 UTC +--- daemon/gdm-server.c.orig 2024-09-16 13:28:26 UTC +++ daemon/gdm-server.c @@ -43,7 +43,9 @@ #include <linux/vt.h> @@ -10,7 +10,7 @@ #ifdef ENABLE_SYSTEMD_JOURNAL #include <systemd/sd-journal.h> -@@ -84,6 +86,9 @@ struct _GdmServer +@@ -86,6 +88,9 @@ struct _GdmServer char *auth_file; guint child_watch_id; @@ -20,7 +20,7 @@ gboolean is_initial; }; -@@ -114,13 +119,60 @@ static void gdm_server_finalize (GObject +@@ -116,13 +121,60 @@ G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT) G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT) @@ -81,7 +81,7 @@ static void gdm_server_ready (GdmServer *server) { -@@ -133,7 +185,26 @@ gdm_server_ready (GdmServer *server) +@@ -135,7 +187,26 @@ gdm_server_ready (GdmServer *server) g_signal_emit (server, signals[READY], 0); } @@ -108,7 +108,7 @@ static GSList *active_servers; static gboolean sigusr1_thread_running; static GCond sigusr1_thread_cond; -@@ -199,6 +270,7 @@ gdm_server_launch_sigusr1_thread_if_needed (void) +@@ -201,6 +272,7 @@ gdm_server_launch_sigusr1_thread_if_needed (void) g_mutex_unlock (&sigusr1_thread_mutex); } } @@ -116,7 +116,7 @@ static void gdm_server_init_command (GdmServer *server) -@@ -307,10 +379,12 @@ gdm_server_resolve_command_line (GdmServer *server, +@@ -310,10 +382,12 @@ gdm_server_resolve_command_line (GdmServer *server, argv[len++] = g_strdup (server->auth_file); } @@ -129,7 +129,7 @@ /* If we were compiled with Xserver >= 1.17 we need to specify * '-listen tcp' as the X server dosen't listen on tcp sockets -@@ -656,11 +730,13 @@ server_child_watch (GPid pid, +@@ -653,11 +727,13 @@ server_child_watch (GPid pid, g_object_unref (server); } diff --git a/x11/gdm/files/patch-daemon_gdm-session-worker-job.c b/x11/gdm/files/patch-daemon_gdm-session-worker-job.c index 484767fdc9d6..9449367ad3f5 100644 --- a/x11/gdm/files/patch-daemon_gdm-session-worker-job.c +++ b/x11/gdm/files/patch-daemon_gdm-session-worker-job.c @@ -1,4 +1,4 @@ ---- daemon/gdm-session-worker-job.c.orig 2022-01-12 14:15:56 UTC +--- daemon/gdm-session-worker-job.c.orig 2024-09-16 13:28:26 UTC +++ daemon/gdm-session-worker-job.c @@ -36,7 +36,9 @@ #include <sys/prctl.h> diff --git a/x11/gdm/files/patch-daemon_gdm-session-worker.c b/x11/gdm/files/patch-daemon_gdm-session-worker.c index 23d9aaa34d46..faf8c99c5392 100644 --- a/x11/gdm/files/patch-daemon_gdm-session-worker.c +++ b/x11/gdm/files/patch-daemon_gdm-session-worker.c @@ -1,4 +1,4 @@ ---- daemon/gdm-session-worker.c.orig 2022-03-21 18:12:40 UTC +--- daemon/gdm-session-worker.c.orig 2024-09-16 13:28:26 UTC +++ daemon/gdm-session-worker.c @@ -28,9 +28,11 @@ #include <string.h> @@ -12,17 +12,18 @@ #include <errno.h> #include <grp.h> #include <pwd.h> -@@ -49,7 +51,9 @@ - +@@ -53,8 +55,10 @@ #include <X11/Xauth.h> + #endif +#ifdef WITH_SYSTEMD #include <systemd/sd-daemon.h> + #include <systemd/sd-login.h> +#endif #ifdef ENABLE_SYSTEMD_JOURNAL #include <systemd/sd-journal.h> -@@ -126,6 +130,10 @@ struct GdmSessionWorkerPrivate +@@ -130,6 +134,10 @@ struct _GdmSessionWorker int exit_code; @@ -33,7 +34,7 @@ pam_handle_t *pam_handle; GPid child_pid; -@@ -140,6 +148,11 @@ struct GdmSessionWorkerPrivate +@@ -144,6 +152,11 @@ struct _GdmSessionWorker char *hostname; char *username; char *log_file; @@ -45,7 +46,7 @@ char *session_id; uid_t uid; gid_t gid; -@@ -207,6 +220,12 @@ typedef int (* GdmSessionWorkerPamNewMessagesFunc) (in +@@ -213,12 +226,223 @@ typedef int (* GdmSessionWorkerPamNewMessagesFunc) (in struct pam_response **, gpointer); @@ -58,9 +59,8 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker, gdm_session_worker, GDM_DBUS_TYPE_WORKER_SKELETON, -@@ -214,6 +233,211 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker, - worker_interface_init) - G_ADD_PRIVATE (GdmSessionWorker)) + G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_WORKER, + worker_interface_init)) +#ifdef WITH_CONSOLE_KIT +static gboolean @@ -78,27 +78,27 @@ + const char *display_hostname; + gint32 uid; + -+ g_assert (worker->priv->session_cookie == NULL); ++ g_assert (worker->session_cookie == NULL); + -+ if (worker->priv->x11_display_name != NULL) { -+ display_name = worker->priv->x11_display_name; ++ if (worker->x11_display_name != NULL) { ++ display_name = worker->x11_display_name; + } else { + display_name = ""; + } -+ if (worker->priv->hostname != NULL) { -+ display_hostname = worker->priv->hostname; ++ if (worker->hostname != NULL) { ++ display_hostname = worker->hostname; + } else { + display_hostname = ""; + } -+ if (worker->priv->display_device != NULL) { -+ display_device = worker->priv->display_device; ++ if (worker->display_device != NULL) { ++ display_device = worker->display_device; + } else { + display_device = ""; + } + -+ g_assert (worker->priv->username != NULL); ++ g_assert (worker->username != NULL); + -+ gdm_get_pwent_for_name (worker->priv->username, &pwent); ++ gdm_get_pwent_for_name (worker->username, &pwent); + if (pwent == NULL) { + goto out; + } @@ -121,21 +121,21 @@ + g_variant_builder_add_parsed (&builder, "('x11-display-device', <%s>)", display_device); + g_variant_builder_add_parsed (&builder, "('x11-display', <%s>)", display_name); + g_variant_builder_add_parsed (&builder, "('remote-host-name', <%s>)", display_hostname); -+ g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", worker->priv->display_is_local); ++ g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", worker->display_is_local); + -+ worker->priv->session_type = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_TYPE"); -+ if (worker->priv->session_type != NULL) { -+ g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", worker->priv->session_type); ++ worker->session_type = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_TYPE"); ++ if (worker->session_type != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", worker->session_type); + } + -+ worker->priv->session_class = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_CLASS"); -+ if (worker->priv->session_class != NULL) { -+ g_variant_builder_add_parsed (&builder, "('session-class', <%s>)", worker->priv->session_class); ++ worker->session_class = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_CLASS"); ++ if (worker->session_class != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-class', <%s>)", worker->session_class); + } + -+ worker->priv->session_service = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_SERVICE"); -+ if (worker->priv->session_service != NULL) { -+ g_variant_builder_add_parsed (&builder, "('session-service', <%s>)", worker->priv->session_service); ++ worker->session_service = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_SERVICE"); ++ if (worker->session_service != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-service', <%s>)", worker->session_service); + } + + parameters = g_variant_builder_end (&builder); @@ -159,12 +159,12 @@ + goto out; + } + -+ g_variant_get (reply, "(s)", &worker->priv->session_cookie); ++ g_variant_get (reply, "(s)", &worker->session_cookie); + + g_variant_unref (reply); + +out: -+ return worker->priv->session_cookie != NULL; ++ return worker->session_cookie != NULL; +} + +static void @@ -175,7 +175,7 @@ + GError *error = NULL; + gboolean was_closed; + -+ if (worker->priv->session_cookie == NULL) { ++ if (worker->session_cookie == NULL) { + return; + } + @@ -195,7 +195,7 @@ + CK_MANAGER_PATH, + CK_MANAGER_INTERFACE, + "CloseSession", -+ g_variant_new ("(s)", worker->priv->session_cookie), ++ g_variant_new ("(s)", worker->session_cookie), + G_VARIANT_TYPE ("(b)"), + G_DBUS_CALL_FLAGS_NONE, + -1, @@ -217,7 +217,7 @@ + g_variant_unref (reply); + +out: -+ g_clear_pointer (&worker->priv->session_cookie, ++ g_clear_pointer (&worker->session_cookie, + (GDestroyNotify) g_free); +} + @@ -245,7 +245,7 @@ + CK_MANAGER_PATH, + CK_MANAGER_INTERFACE, + "GetSessionForCookie", -+ g_variant_new ("(s)", worker->priv->session_cookie), ++ g_variant_new ("(s)", worker->session_cookie), + G_VARIANT_TYPE ("(o)"), + G_DBUS_CALL_FLAGS_NONE, + -1, @@ -270,25 +270,15 @@ /* adapted from glib script_execute */ static void script_execute (const gchar *file, -@@ -670,7 +894,9 @@ gdm_session_worker_process_pam_message (GdmSessionWork - char *user_answer; - gboolean res; - char *utf8_msg; -+#ifdef PAM_RADIO_TYPE - char *msg; -+#endif - - if (response != NULL) { - *response = NULL; -@@ -914,6 +1140,7 @@ gdm_session_worker_stop_auditor (GdmSessionWorker *wor - worker->priv->auditor = NULL; +@@ -972,6 +1196,7 @@ gdm_session_worker_stop_auditor (GdmSessionWorker *wor + worker->auditor = NULL; } +#ifdef WITH_SYSTEMD static void on_release_display (int signal) { -@@ -1056,6 +1283,7 @@ jump_to_vt (GdmSessionWorker *worker, +@@ -1114,6 +1339,7 @@ jump_to_vt (GdmSessionWorker *worker, close (active_vt_tty_fd); } @@ -296,7 +286,7 @@ static void gdm_session_worker_set_state (GdmSessionWorker *worker, -@@ -1158,7 +1386,9 @@ gdm_session_worker_initialize_pam (GdmSessionWorker +@@ -1216,7 +1442,9 @@ gdm_session_worker_initialize_pam (GdmSessionWorker { struct pam_conv pam_conversation; int error_code; @@ -304,9 +294,9 @@ char tty_string[256]; +#endif - g_assert (worker->priv->pam_handle == NULL); - -@@ -1230,6 +1460,10 @@ gdm_session_worker_initialize_pam (GdmSessionWorker + g_assert (service != NULL); + g_assert (worker->pam_handle == NULL); +@@ -1297,6 +1525,10 @@ gdm_session_worker_initialize_pam (GdmSessionWorker gdm_session_worker_set_environment_variable (worker, "XDG_SEAT", seat_id); } @@ -317,36 +307,34 @@ if (strcmp (service, "gdm-launch-environment") == 0) { gdm_session_worker_set_environment_variable (worker, "XDG_SESSION_CLASS", "greeter"); } -@@ -1237,12 +1471,14 @@ gdm_session_worker_initialize_pam (GdmSessionWorker +@@ -1304,13 +1536,6 @@ gdm_session_worker_initialize_pam (GdmSessionWorker g_debug ("GdmSessionWorker: state SETUP_COMPLETE"); gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE); -+#ifdef WITH_SYSTEMD - /* Temporarily set PAM_TTY with the login VT, - PAM_TTY will be reset with the users VT right before the user session is opened */ - g_snprintf (tty_string, 256, "/dev/tty%d", GDM_INITIAL_VT); - pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string); +- if (g_strcmp0 (seat_id, "seat0") == 0 && worker->seat0_has_vts) { +- /* Temporarily set PAM_TTY with the login VT, +- PAM_TTY will be reset with the users VT right before the user session is opened */ +- g_snprintf (tty_string, 256, "/dev/tty%d", GDM_INITIAL_VT); +- pam_set_item (worker->pam_handle, PAM_TTY, tty_string); +- } +- if (!display_is_local) - worker->priv->password_is_required = TRUE; -+#endif + worker->password_is_required = TRUE; - out: - if (error_code != PAM_SUCCESS) { -@@ -1545,7 +1781,11 @@ _lookup_passwd_info (const char *username, +@@ -1621,7 +1846,11 @@ _lookup_passwd_info (const char *username, if (passwd_entry->pw_shell != NULL && passwd_entry->pw_shell[0] != '\0') { *shellp = g_strdup (passwd_entry->pw_shell); } else { -- *shellp = g_strdup ("/bin/bash"); -+#if defined(__OpenBSD__) -+ *shellp = g_strdup ("/bin/ksh"); -+#else ++#if defined(__FreeBSD__) + *shellp = g_strdup ("/bin/sh"); ++#else + *shellp = g_strdup ("/bin/bash"); +#endif } } ret = TRUE; -@@ -1689,6 +1929,20 @@ gdm_session_worker_get_environment (GdmSessionWorker * - return (const char * const *) pam_getenvlist (worker->priv->pam_handle); +@@ -1760,6 +1989,20 @@ gdm_session_worker_get_environment (GdmSessionWorker * + return (const char * const *) pam_getenvlist (worker->pam_handle); } +#ifdef WITH_CONSOLE_KIT @@ -355,10 +343,10 @@ +{ + open_ck_session (worker); + -+ if (worker->priv->session_cookie != NULL) { ++ if (worker->session_cookie != NULL) { + gdm_session_worker_set_environment_variable (worker, + "XDG_SESSION_COOKIE", -+ worker->priv->session_cookie); ++ worker->session_cookie); + } +} +#endif @@ -366,7 +354,7 @@ static gboolean run_script (GdmSessionWorker *worker, const char *dir) -@@ -1766,6 +2020,10 @@ session_worker_child_watch (GPid pid, +@@ -1837,6 +2080,10 @@ session_worker_child_watch (GPid pid, : WIFSIGNALED (status) ? WTERMSIG (status) : -1); @@ -376,8 +364,8 @@ + gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS); - worker->priv->child_pid = -1; -@@ -1978,6 +2236,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w + worker->child_pid = -1; +@@ -2037,6 +2284,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w error_code = PAM_SUCCESS; @@ -385,15 +373,15 @@ /* If we're in new vt mode, jump to the new vt now. There's no need to jump for * the other two modes: in the logind case, the session will activate itself when * ready, and in the reuse server case, we're already on the correct VT. */ -@@ -1986,6 +2245,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w - jump_to_vt (worker, worker->priv->session_vt); +@@ -2045,6 +2293,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w + jump_to_vt (worker, worker->session_vt); } } +#endif - if (!worker->priv->is_program_session && !run_script (worker, GDMCONFDIR "/PostLogin")) { + if (!worker->is_program_session && !run_script (worker, GDMCONFDIR "/PostLogin")) { g_set_error (error, -@@ -2048,6 +2308,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2107,6 +2356,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w _exit (EXIT_FAILURE); } @@ -401,7 +389,7 @@ /* Take control of the tty */ if (needs_controlling_terminal) { -@@ -2055,6 +2316,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2114,6 +2364,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w g_debug ("GdmSessionWorker: could not take control of tty: %m"); } } @@ -409,7 +397,7 @@ #ifdef HAVE_LOGINCAP if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) { -@@ -2186,6 +2448,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2242,6 +2493,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w return TRUE; } @@ -417,7 +405,7 @@ static gboolean set_up_for_new_vt (GdmSessionWorker *worker) { -@@ -2286,6 +2549,7 @@ fail: +@@ -2341,6 +2593,7 @@ fail: close (fd); return FALSE; } @@ -425,38 +413,38 @@ static gboolean set_up_for_current_vt (GdmSessionWorker *worker, -@@ -2353,12 +2617,14 @@ set_up_for_current_vt (GdmSessionWorker *worker, +@@ -2410,12 +2663,14 @@ set_up_for_current_vt (GdmSessionWorker *worker, } #endif +#ifdef WITH_SYSTEMD - if (g_strcmp0 (worker->priv->display_seat_id, "seat0") == 0) { + if (g_strcmp0 (worker->display_seat_id, "seat0") == 0 && worker->seat0_has_vts) { g_debug ("GdmSessionWorker: setting XDG_VTNR to current vt"); set_xdg_vtnr_to_current_vt (worker); } else { - g_debug ("GdmSessionWorker: not setting XDG_VTNR since not seat0"); + g_debug ("GdmSessionWorker: not setting XDG_VTNR since no VTs on seat"); } +#endif return TRUE; - out: -@@ -2384,6 +2650,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo - break; - case GDM_SESSION_DISPLAY_MODE_NEW_VT: - case GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED: + } +@@ -2440,6 +2695,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo + break; + case GDM_SESSION_DISPLAY_MODE_NEW_VT: + case GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED: +#ifdef WITH_SYSTEMD - if (!set_up_for_new_vt (worker)) { - g_set_error (error, - GDM_SESSION_WORKER_ERROR, -@@ -2391,6 +2658,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo - "Unable to open VT"); - return FALSE; - } + if (!set_up_for_new_vt (worker)) { + g_set_error (error, + GDM_SESSION_WORKER_ERROR, +@@ -2447,6 +2703,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo + "Unable to open VT"); + return FALSE; + } +#endif - break; + break; + } } - -@@ -2413,8 +2681,16 @@ gdm_session_worker_open_session (GdmSessionWorker *wo +@@ -2470,8 +2727,16 @@ gdm_session_worker_open_session (GdmSessionWorker *wo g_debug ("GdmSessionWorker: state SESSION_OPENED"); gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_SESSION_OPENED); @@ -471,9 +459,9 @@ +#endif + if (session_id != NULL) { - g_free (worker->priv->session_id); - worker->priv->session_id = session_id; -@@ -2968,6 +3244,7 @@ gdm_session_worker_handle_open (GdmDBusWorker + g_free (worker->session_id); + worker->session_id = g_steal_pointer (&session_id); +@@ -3022,6 +3287,7 @@ gdm_session_worker_handle_open (GdmDBusWorker return TRUE; } @@ -481,22 +469,32 @@ static char ** filter_extensions (const char * const *extensions) { -@@ -2993,6 +3270,7 @@ filter_extensions (const char * const *extensions) +@@ -3045,6 +3311,7 @@ filter_extensions (const char * const *extensions) - return filtered_extensions; + return g_steal_pointer (&filtered_extensions); } +#endif static gboolean gdm_session_worker_handle_initialize (GdmDBusWorker *object, -@@ -3012,8 +3290,10 @@ gdm_session_worker_handle_initialize (GdmDBusWorker +@@ -3064,8 +3331,10 @@ gdm_session_worker_handle_initialize (GdmDBusWorker while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) { if (g_strcmp0 (key, "service") == 0) { - worker->priv->service = g_variant_dup_string (value, NULL); + worker->service = g_variant_dup_string (value, NULL); +#ifdef SUPPORTS_PAM_EXTENSIONS } else if (g_strcmp0 (key, "extensions") == 0) { - worker->priv->extensions = filter_extensions (g_variant_get_strv (value, NULL)); + worker->extensions = filter_extensions (g_variant_get_strv (value, NULL)); +#endif } else if (g_strcmp0 (key, "username") == 0) { - worker->priv->username = g_variant_dup_string (value, NULL); + worker->username = g_variant_dup_string (value, NULL); } else if (g_strcmp0 (key, "is-program-session") == 0) { +@@ -3089,7 +3358,9 @@ gdm_session_worker_handle_initialize (GdmDBusWorker + } + } + ++#ifdef WITH_SYSTEMD + worker->seat0_has_vts = sd_seat_can_tty ("seat0"); ++#endif + + worker->pending_invocation = invocation; + diff --git a/x11/gdm/files/patch-daemon_gdm-session.c b/x11/gdm/files/patch-daemon_gdm-session.c index 86eeacc33840..b10afa1d05fc 100644 --- a/x11/gdm/files/patch-daemon_gdm-session.c +++ b/x11/gdm/files/patch-daemon_gdm-session.c @@ -1,6 +1,16 @@ ---- daemon/gdm-session.c.orig 2022-01-12 14:15:56 UTC +--- daemon/gdm-session.c.orig 2024-09-16 13:28:26 UTC +++ daemon/gdm-session.c -@@ -116,6 +116,9 @@ struct _GdmSession +@@ -45,7 +45,9 @@ + + #include <json-glib/json-glib.h> + ++#ifdef WITH_SYSTEMD + #include <systemd/sd-login.h> ++#endif + + #include "gdm-session.h" + #include "gdm-session-glue.h" +@@ -120,6 +122,9 @@ struct _GdmSession /* object lifetime scope */ char *session_type; @@ -10,7 +20,7 @@ char *display_name; char *display_hostname; char *display_device; -@@ -371,7 +374,9 @@ get_system_session_dirs (GdmSession *self, +@@ -387,7 +392,9 @@ get_system_session_dirs (GdmSession *self, DATADIR "/xsessions/", }; @@ -20,3 +30,19 @@ search_array = g_array_new (TRUE, TRUE, sizeof (char *)); +@@ -3386,6 +3393,7 @@ gdm_session_is_frozen (GdmSession *self) + gboolean + gdm_session_is_frozen (GdmSession *self) + { ++#ifdef WITH_SYSTEMD + g_autofree char *cgroup = NULL, *path = NULL, *data = NULL; + g_auto (GStrv) arr = NULL; + +@@ -3408,6 +3416,7 @@ gdm_session_is_frozen (GdmSession *self) + if (g_str_equal (arr[i], "frozen")) + return g_str_equal (arr[i + 1], "1"); + } ++#endif + return FALSE; + } + diff --git a/x11/gdm/files/patch-daemon_gdm-wayland-session.c b/x11/gdm/files/patch-daemon_gdm-wayland-session.c new file mode 100644 index 000000000000..03e60d4c6d91 --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-wayland-session.c @@ -0,0 +1,36 @@ +--- daemon/gdm-wayland-session.c.orig 2023-09-14 15:27:04 UTC ++++ daemon/gdm-wayland-session.c +@@ -212,32 +212,7 @@ import_environment (State *state, + import_environment (State *state, + GCancellable *cancellable) + { +- g_autoptr(GVariant) reply = NULL; +- g_autoptr(GVariant) environment_variant = NULL; +- g_autoptr(GError) error = NULL; +- +- reply = g_dbus_connection_call_sync (state->bus_connection, +- "org.freedesktop.systemd1", +- "/org/freedesktop/systemd1", +- "org.freedesktop.DBus.Properties", +- "Get", +- g_variant_new ("(ss)", +- "org.freedesktop.systemd1.Manager", +- "Environment"), +- NULL, +- G_DBUS_CALL_FLAGS_NONE, +- -1, cancellable, &error); +- +- if (reply == NULL) { +- g_debug ("could not fetch environment: %s", error->message); +- return FALSE; +- } +- +- g_variant_get (reply, "(v)", &environment_variant); +- +- state->environment = g_variant_dup_strv (environment_variant, NULL); +- +- return TRUE; ++ return FALSE; + } + + static void diff --git a/x11/gdm/files/patch-daemon_gdm-x-session.c b/x11/gdm/files/patch-daemon_gdm-x-session.c index 5846e278e63e..e8555ea21373 100644 --- a/x11/gdm/files/patch-daemon_gdm-x-session.c +++ b/x11/gdm/files/patch-daemon_gdm-x-session.c @@ -1,20 +1,28 @@ ---- daemon/gdm-x-session.c.orig 2022-01-12 14:15:56 UTC +--- daemon/gdm-x-session.c.orig 2023-03-20 15:42:37 UTC +++ daemon/gdm-x-session.c -@@ -114,7 +114,7 @@ prepare_auth_file (void) +@@ -20,6 +20,7 @@ + #include "config.h" + + #include <locale.h> ++#include <limits.h> + #include <sysexits.h> + + #include "gdm-common.h" +@@ -114,7 +115,7 @@ prepare_auth_file (void) GError *error = NULL; gboolean prepared = FALSE; Xauth auth_entry = { 0 }; - char localhost[HOST_NAME_MAX + 1] = ""; -+ char localhost[256] = ""; ++ char localhost[_POSIX_HOST_NAME_MAX + 1] = ""; g_debug ("Preparing auth file for X server"); -@@ -124,7 +124,7 @@ prepare_auth_file (void) +@@ -124,7 +125,7 @@ prepare_auth_file (void) return NULL; } - if (gethostname (localhost, HOST_NAME_MAX) < 0) { -+ if (gethostname (localhost, 255) < 0) { ++ if (gethostname (localhost, _POSIX_HOST_NAME_MAX) < 0) { strncpy (localhost, "localhost", sizeof (localhost) - 1); } diff --git a/x11/gdm/files/patch-daemon_main.c b/x11/gdm/files/patch-daemon_main.c index bf8e2ba56b83..ddbebb2f881a 100644 --- a/x11/gdm/files/patch-daemon_main.c +++ b/x11/gdm/files/patch-daemon_main.c @@ -1,4 +1,4 @@ ---- daemon/main.c.orig 2022-03-21 18:12:40 UTC +--- daemon/main.c.orig 2023-03-20 15:42:37 UTC +++ daemon/main.c @@ -281,6 +281,7 @@ is_debug_set (void) return debug; diff --git a/x11/gdm/files/patch-daemon_meson.build b/x11/gdm/files/patch-daemon_meson.build index 710e52e9e3d1..b55ac1cb4189 100644 --- a/x11/gdm/files/patch-daemon_meson.build +++ b/x11/gdm/files/patch-daemon_meson.build @@ -1,6 +1,6 @@ ---- daemon/meson.build.orig 2022-03-21 18:12:40 UTC +--- daemon/meson.build.orig 2024-09-16 13:28:26 UTC +++ daemon/meson.build -@@ -128,6 +128,7 @@ gdm_session_worker = executable('gdm-session-worker', +@@ -145,6 +145,7 @@ gdm_session_worker = executable('gdm-session-worker', gdm_session_worker = executable('gdm-session-worker', gdm_session_worker_src, dependencies: gdm_session_worker_deps, @@ -8,7 +8,7 @@ include_directories: gdm_session_worker_includes, install: true, install_dir: get_option('libexecdir'), -@@ -211,6 +212,7 @@ gdm_daemon = executable('gdm', +@@ -234,6 +235,7 @@ gdm_daemon = executable('gdm', gdm_daemon = executable('gdm', [ gdm_daemon_sources, gdm_daemon_gen_sources ], dependencies: gdm_daemon_deps, diff --git a/x11/gdm/files/patch-data_gdm.conf-custom.in b/x11/gdm/files/patch-data_gdm.conf-custom.in new file mode 100644 index 000000000000..735db8e3d5f8 --- /dev/null +++ b/x11/gdm/files/patch-data_gdm.conf-custom.in @@ -0,0 +1,12 @@ +--- data/gdm.conf-custom.in.orig 2023-05-05 18:12:53 UTC ++++ data/gdm.conf-custom.in +@@ -2,7 +2,8 @@ + + [daemon] + # Uncomment the line below to force the login screen to use Xorg +-#WaylandEnable=false ++WaylandEnable=false ++PreferredDisplayServer=xorg + + [security] + diff --git a/x11/gdm/files/patch-data_meson.build b/x11/gdm/files/patch-data_meson.build index 7ce3022632a4..19e1e5024cac 100644 --- a/x11/gdm/files/patch-data_meson.build +++ b/x11/gdm/files/patch-data_meson.build @@ -1,48 +1,97 @@ ---- data/meson.build.orig 2022-01-12 14:15:56 UTC +--- data/meson.build.orig 2024-09-16 13:28:26 UTC +++ data/meson.build -@@ -164,41 +164,43 @@ else +@@ -13,7 +13,7 @@ foreach file : [ 'Init', 'PreSession', 'PostSession' ] + install_data(generated_file, + install_dir: gdmconfdir / file, + install_mode: 'rwxr-xr-x', +- rename: 'Default' ++ rename: 'Default.sample' + ) + endforeach + +@@ -26,7 +26,7 @@ configure_file( + # gdm.conf + configure_file( + input: 'gdm.conf.in', +- output: '@BASENAME@', ++ output: 'gdm.conf.sample', + configuration: { + 'GDM_USERNAME': get_option('user'), + }, +@@ -34,10 +34,10 @@ configure_file( + ) + configure_file( + input: 'gdm.conf-custom.in', +- output: gdm_custom_conf.split('/')[-1], ++ output: 'custom.conf.sample', + copy: true, + install_mode: 'rw-r--r--', +- install_dir: run_command(find_program('dirname'), gdm_custom_conf).stdout().strip(), ++ install_dir: gdmconfdir, + ) + + # GSettings schema +@@ -163,59 +163,61 @@ endif service_config.set('PLYMOUTH_QUIT_SERVICE', '') endif --if get_option('systemdsystemunitdir') != '' -- systemd_systemunitdir = get_option('systemdsystemunitdir') --else -- systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') --endif +-systemdsystemunitdir = get_option('systemdsystemunitdir') +-if systemdsystemunitdir != 'no' +- if get_option('systemdsystemunitdir') != '' +- systemd_systemunitdir = get_option('systemdsystemunitdir') +- else +- assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd system unit dir or disable it') +- systemd_systemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir') +if host_machine.system() == 'linux' -+ if get_option('systemdsystemunitdir') != '' -+ systemd_systemunitdir = get_option('systemdsystemunitdir') -+ else -+ systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') -+ endif ++ systemdsystemunitdir = get_option('systemdsystemunitdir') ++ if systemdsystemunitdir != 'no' ++ if get_option('systemdsystemunitdir') != '' ++ systemd_systemunitdir = get_option('systemdsystemunitdir') ++ else ++ assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd system unit dir or disable it') ++ systemd_systemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir') ++ endif + endif +-endif --if get_option('systemduserunitdir') != '' -- systemd_userunitdir = get_option('systemduserunitdir') --else -- systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir', -- define_variable: ['prefix', get_option('prefix')]) +-systemduserunitdir = get_option('systemduserunitdir') +-if systemduserunitdir != 'no' +- if get_option('systemduserunitdir') != '' +- systemd_userunitdir = get_option('systemduserunitdir') +- else +- assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it') +- systemd_userunitdir = systemd_dep.get_variable(pkgconfig: 'systemduserunitdir', +- pkgconfig_define: ['prefix', get_option('prefix')]) ++ systemduserunitdir = get_option('systemduserunitdir') ++ if systemduserunitdir != 'no' ++ if get_option('systemduserunitdir') != '' ++ systemd_userunitdir = get_option('systemduserunitdir') ++ else ++ assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it') ++ systemd_userunitdir = systemd_dep.get_variable(pkgconfig: 'systemduserunitdir', ++ pkgconfig_define: ['prefix', get_option('prefix')]) ++ endif + endif -endif -+ if get_option('systemduserunitdir') != '' -+ systemd_userunitdir = get_option('systemduserunitdir') -+ else -+ systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir', -+ define_variable: ['prefix', get_option('prefix')]) -+ endif --configure_file( -- input: 'gdm.service.in', -- output: '@BASENAME@', -- configuration: service_config, -- install_dir: systemd_systemunitdir, -- format: 'cmake' --) -+ configure_file( -+ input: 'gdm.service.in', -+ output: '@BASENAME@', -+ configuration: service_config, -+ install_dir: systemd_systemunitdir, -+ format: 'cmake' -+ ) +-if systemdsystemunitdir != 'no' +- configure_file( +- input: 'gdm.service.in', +- output: '@BASENAME@', +- configuration: service_config, +- install_dir: systemd_systemunitdir, +- format: 'cmake' +- ) +-endif ++ if systemdsystemunitdir != 'no' ++ configure_file( ++ input: 'gdm.service.in', ++ output: '@BASENAME@', ++ configuration: service_config, ++ install_dir: systemd_systemunitdir, ++ format: 'cmake' ++ ) ++ endif -gdm_gnome_session_wanted_targets = [] -foreach component: gdm_gnome_user_session_wanted_components @@ -53,25 +102,35 @@ + gdm_gnome_session_wanted_targets += 'Wants=@0@.target'.format(component) + endforeach --configure_file( -- input: 'session.conf.in', -- output: 'session.conf', -- configuration: { -- 'requires_component': gdm_gnome_shell_component, -- 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), -- }, -- install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', --) -+ configure_file( -+ input: 'session.conf.in', -+ output: 'session.conf', -+ configuration: { -+ 'requires_component': gdm_gnome_shell_component, -+ 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), -+ }, -+ install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', -+ ) -+endif +-if systemduserunitdir != 'no' +- configure_file( +- input: 'session.conf.in', +- output: 'session.conf', +- configuration: { +- 'requires_component': gdm_gnome_shell_component, +- 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), +- }, +- install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', +- ) ++ if systemduserunitdir != 'no' ++ configure_file( ++ input: 'session.conf.in', ++ output: 'session.conf', ++ configuration: { ++ 'requires_component': gdm_gnome_shell_component, ++ 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), ++ }, ++ install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', ++ ) ++ endif + endif # XSession - if get_option('gdm-xsession') + if get_option('gdm-xsession') and have_x11_support + configure_file( + input: 'Xsession.in', +- output: '@BASENAME@', ++ output: 'Xsession.sample', + configuration: { + 'libexecdir': gdm_prefix / get_option('libexecdir'), + 'XSESSION_SHELL': get_option('solaris')? '/bin/ksh' : '/bin/sh', diff --git a/x11/gdm/files/patch-libgdm_gdm-sessions.c b/x11/gdm/files/patch-libgdm_gdm-sessions.c new file mode 100644 index 000000000000..908a61546e16 --- /dev/null +++ b/x11/gdm/files/patch-libgdm_gdm-sessions.c @@ -0,0 +1,38 @@ +--- libgdm/gdm-sessions.c.orig 2024-05-29 15:50:27 UTC ++++ libgdm/gdm-sessions.c +@@ -35,7 +35,9 @@ + #include <glib/gi18n.h> + #include <glib/gstdio.h> + ++#ifdef WITH_SYSTEMD + #include <systemd/sd-login.h> ++#endif + + #include "gdm-sessions.h" + +@@ -60,6 +62,7 @@ gdm_session_file_free (GdmSessionFile *session) + g_free (session); + } + ++#ifdef WITH_SYSTEMD + static char * + get_systemd_session (void) + { +@@ -104,6 +107,7 @@ get_systemd_seat (void) + + return g_steal_pointer (&seat); + } ++#endif + + /* adapted from gnome-menus desktop-entries.c */ + static gboolean +@@ -138,7 +142,9 @@ key_file_is_relevant (GKeyFile *key_file) + g_error_free (error); + } + ++#ifdef WITH_SYSTEMD + seat = get_systemd_seat (); ++#endif + + only_headless_allowed = seat == NULL; + diff --git a/x11/gdm/files/patch-libgdm_gdm-user-switching.c b/x11/gdm/files/patch-libgdm_gdm-user-switching.c deleted file mode 100644 index f3b45165cea4..000000000000 --- a/x11/gdm/files/patch-libgdm_gdm-user-switching.c +++ /dev/null @@ -1,48 +0,0 @@ ---- libgdm/gdm-user-switching.c.orig 2022-01-12 14:15:56 UTC -+++ libgdm/gdm-user-switching.c -@@ -31,7 +31,9 @@ - #include <glib-object.h> - #include <gio/gio.h> - -+#ifdef WITH_SYSTEMD - #include <systemd/sd-login.h> -+#endif - - #include "common/gdm-common.h" - #include "gdm-user-switching.h" -@@ -76,6 +78,7 @@ activate_session_id (GDBusConnection *connection, - { - GVariant *reply; - -+#if defined(WITH_SYSTEMD) - reply = g_dbus_connection_call_sync (connection, - "org.freedesktop.login1", - "/org/freedesktop/login1", -@@ -86,6 +89,18 @@ activate_session_id (GDBusConnection *connection, - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, error); -+#elif defined(WITH_CONSOLE_KIT) -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "ActivateSession", -+ g_variant_new ("(o)", session_id), -+ NULL, -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, error); -+#endif - if (reply == NULL) { - g_prefix_error (error, _("Unable to activate session: ")); - return FALSE; -@@ -227,7 +242,7 @@ goto_login_session (GDBusConnection *connection, - } - } - -- if (! ret && g_strcmp0 (seat_id, "seat0") == 0) { -+ if (! ret && g_strcmp0 (seat_id, SEAT_ID) == 0) { - res = create_transient_display (connection, cancellable, error); - if (res) { - ret = TRUE; diff --git a/x11/gdm/files/patch-meson.build b/x11/gdm/files/patch-meson.build index 33555b783dc8..f6f1f4ffcd8b 100644 --- a/x11/gdm/files/patch-meson.build +++ b/x11/gdm/files/patch-meson.build @@ -1,51 +1,82 @@ ---- meson.build.orig 2022-03-21 18:12:40 UTC +--- meson.build.orig 2024-09-16 13:28:26 UTC +++ meson.build -@@ -37,8 +37,14 @@ config_h_dir = include_directories('.') - config_h_dir = include_directories('.') +@@ -48,9 +48,15 @@ endif + endif # Dependencies -udev_dep = dependency('udev') -gudev_dep = dependency('gudev-1.0', version: '>= 232') +if host_machine.system() == 'linux' + udev_dep = dependency('udev') -+ gudev_dep = dependency('gudev-1.0', version: '>= 232') +else + udev_dep = declare_dependency() + gudev_dep = declare_dependency() -+ udev_dir = '/usr/local/lib/udev/rules.d' +endif - glib_min_version = '2.56.0' - -@@ -89,17 +95,22 @@ else - else - # what to do, what to do, this is wrong, but this just sets the - # defaults, perhaps this user is cross compiling or some such -- x_path = '/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin' -- x_bin = '/usr/bin/X' -+ x_path = '/usr/local/bin/X11:/usr/local/bin:/opt/X11R6/bin' -+ x_bin = '/usr/local/bin/X' - endif - xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp')) - if xdmcp_dep.found() and get_option('tcp-wrappers') - libwrap_dep = cc.find_library('wrap') ++gudev_dep = dependency('gudev-1.0', version: '>= 232', required: false) ++ + # PAM + libpam_dep = cc.find_library('pam') + pam_extensions_supported = cc.has_header_symbol( +@@ -123,23 +129,29 @@ endif + have_xdmcp = false endif # systemd --systemd_dep = dependency('systemd') --libsystemd_dep = dependency('libsystemd') --if meson.version().version_compare('>= 0.53') +-logind_provider = get_option('logind-provider') +-systemd_dep = dependency('systemd', required: false) +-if logind_provider == 'systemd' +- libsystemd_dep = dependency('libsystemd') +- logind_dep = libsystemd_dep +- systemd_multiseat_x = find_program('systemd-multi-seat-x', +- required: false, +- dirs: [ +- systemd_dep.get_variable(pkgconfig: 'systemdutildir'), +- '/lib/systemd', +- '/usr/lib/systemd', +- ]) +- systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x' +if host_machine.system() == 'linux' -+ systemd_dep = dependency('systemd') -+ libsystemd_dep = dependency('libsystemd') -+else -+ systemd_dep = declare_dependency() -+ libsystemd_dep = declare_dependency() -+endif ++ logind_provider = get_option('logind-provider') ++ systemd_dep = dependency('systemd', required: false) ++ if logind_provider == 'systemd' ++ libsystemd_dep = dependency('libsystemd') ++ logind_dep = libsystemd_dep ++ systemd_multiseat_x = find_program('systemd-multi-seat-x', ++ required: false, ++ dirs: [ ++ systemd_dep.get_variable(pkgconfig: 'systemdutildir'), ++ '/lib/systemd', ++ '/usr/lib/systemd', ++ ]) ++ systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x' ++ else ++ elogind_dep = dependency('libelogind') ++ logind_dep = elogind_dep ++ systemd_x_server = 'disabled' ++ endif + else +- elogind_dep = dependency('libelogind') +- logind_dep = elogind_dep +- systemd_x_server = 'disabled' ++ systemd_dep = dependency('libconsolekit') ++ logind_dep = dependency('libconsolekit') ++ systemd_x_server = '/lib/systemd/systemd-multi-seat-x' + endif + # Plymouth + plymouth_dep = dependency('ply-boot-client', required: get_option('plymouth')) +@@ -292,7 +304,10 @@ conf.set_quoted('X_PATH', x_path) + conf.set('WITH_PLYMOUTH', plymouth_dep.found()) + conf.set_quoted('X_SERVER', x_bin) + conf.set_quoted('X_PATH', x_path) +-conf.set('HAVE_UDEV', gudev_dep.found()) ++# Avoid build failure when libgudev is installed +if host_machine.system() == 'linux' - systemd_multiseat_x = find_program('systemd-multi-seat-x', - required: false, - dirs: [ -@@ -257,6 +268,7 @@ conf.set('ENABLE_IPV6', get_option('ipv6')) ++ conf.set('HAVE_UDEV', gudev_dep.found()) ++endif + conf.set('HAVE_UT_UT_HOST', utmp_has_host_field) + conf.set('HAVE_UT_UT_PID', utmp_has_pid_field) + conf.set('HAVE_UT_UT_ID', utmp_has_id_field) +@@ -304,6 +319,7 @@ conf.set('ENABLE_IPV6', get_option('ipv6')) conf.set('HAVE_UT_UT_TV', utmp_has_tv_field) conf.set('HAVE_UT_UT_SYSLEN', utmp_has_syslen_field) conf.set('ENABLE_IPV6', get_option('ipv6')) |