- Add hook to allow for plymouth transition

This commit is contained in:
Ray Strode 2008-09-11 21:10:53 +00:00
parent c237457f11
commit 32ae6ba5f6
2 changed files with 179 additions and 1 deletions

View File

@ -0,0 +1,172 @@
commit 01247e06779bef0b4619d6807f31e118d5b55cf0
Author: Ray Strode <rstrode@halfline-kentsfield.usersys.redhat.com>
Date: Thu Sep 11 12:54:19 2008 -0400
Force vt if force-display-on-active-vt is set
This will allow plymouth and gdm to transition smoothly
diff --git a/configure.ac b/configure.ac
index 4a08418..8891882 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1311,6 +1311,23 @@ fi
AC_SUBST(GDM_XAUTH_DIR)
dnl ---------------------------------------------------------------------------
+dnl - Directory to spool events from other processes
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_WITH(spool-dir,
+ AS_HELP_STRING([--with-spool-dir=<dir>],
+ [spool directory]))
+
+if ! test -z "$with_spool_dir"; then
+ GDM_SPOOL_DIR=$with_spool_dir
+else
+ GDM_SPOOL_DIR=${localstatedir}/spool/gdm
+fi
+
+AC_SUBST(GDM_SPOOL_DIR)
+
+
+dnl ---------------------------------------------------------------------------
dnl - Finish
dnl ---------------------------------------------------------------------------
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 1846ed2..ced03a3 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -16,6 +16,7 @@ INCLUDES = \
-DPIXMAPDIR=\"$(pixmapdir)\" \
-DSBINDIR=\"$(sbindir)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ -DGDM_SPOOL_DIR=\"$(GDM_SPOOL_DIR)\" \
-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\" \
-DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \
-DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index ca37a2a..e6f821f 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -34,6 +34,8 @@
#include <signal.h>
#include <sys/resource.h>
+#include <linux/vt.h>
+
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
@@ -663,6 +665,56 @@ gdm_server_spawn (GdmServer *server,
return ret;
}
+static gboolean
+should_force_display_on_active_vt (void)
+{
+ gboolean should_force_display_on_active_vt;
+
+ should_force_display_on_active_vt = g_file_test (GDM_SPOOL_DIR "/force-display-on-active-vt",
+ G_FILE_TEST_EXISTS);
+ g_unlink (GDM_SPOOL_DIR "/force-display-on-active-vt");
+
+ return should_force_display_on_active_vt;
+}
+
+static int
+get_active_vt (void)
+{
+ int console_fd;
+ struct vt_stat console_state = { 0 };
+
+ console_fd = open ("/dev/tty0", O_RDONLY | O_NOCTTY);
+
+ if (console_fd < 0) {
+ goto out;
+ }
+
+ if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) {
+ goto out;
+ }
+
+out:
+ if (console_fd >= 0) {
+ close (console_fd);
+ }
+
+ return console_state.v_active;
+}
+
+static char *
+get_active_vt_as_string (void)
+{
+ int vt;
+
+ vt = get_active_vt ();
+
+ if (vt <= 0) {
+ return NULL;
+ }
+
+ return g_strdup_printf ("vt%d", vt);
+}
+
/**
* gdm_server_start:
* @disp: Pointer to a GdmDisplay structure
@@ -675,8 +727,18 @@ gdm_server_start (GdmServer *server)
{
gboolean res;
- /* fork X server process */
- res = gdm_server_spawn (server, NULL);
+ if (should_force_display_on_active_vt () || TRUE) {
+ char *vt;
+
+ g_free (server->priv->command);
+ server->priv->command = g_strdup (X_SERVER " -nr -verbose");
+ vt = get_active_vt_as_string ();
+ res = gdm_server_spawn (server, vt);
+ g_free (vt);
+ } else {
+ /* fork X server process */
+ res = gdm_server_spawn (server, NULL);
+ }
return res;
}
diff --git a/data/Makefile.am b/data/Makefile.am
index 30e1f55..400c43d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -13,6 +13,7 @@ predir = $(gdmconfdir)/PreSession
postlogindir = $(gdmconfdir)/PostLogin
workingdir = $(GDM_WORKING_DIR)
xauthdir = $(GDM_XAUTH_DIR)
+spooldir = $(GDM_SPOOL_DIR)
if OS_SOLARIS
DISTRO_XSESSION=$(srcdir)/Xsession.solaris
@@ -132,6 +133,7 @@ uninstall-hook:
-rf \
$(DESTDIR)$(workingdir)/.gconf.mandatory \
$(DESTDIR)$(xauthdir)
+ $(DESTDIR)$(spooldir)
install-data-hook: gdm.conf-custom Xsession Init PostSession PreSession gconf.path
if test '!' -d $(DESTDIR)$(gdmconfdir); then \
@@ -219,6 +221,12 @@ install-data-hook: gdm.conf-custom Xsession Init PostSession PreSession gconf.pa
chown root:gdm $(DESTDIR)$(workingdir) || : ; \
fi
+ if test '!' -d $(DESTDIR)$(spooldir); then \
+ $(mkinstalldirs) $(DESTDIR)$(spooldir); \
+ chmod 1770 $(DESTDIR)$(spooldir); \
+ chown root:gdm $(DESTDIR)$(spooldir) || : ; \
+ fi
+
$(INSTALL_DATA) $(srcdir)/gconf.path $(DESTDIR)$(workingdir)/.gconf.path
gconftool-2 --direct --config-source=xml:merged:$(DESTDIR)$(workingdir)/.gconf.mandatory --recursive-unset /
gconftool-2 --direct --config-source=xml:merged:$(DESTDIR)$(workingdir)/.gconf.mandatory --load $(srcdir)/session-setup.entries

View File

@ -16,7 +16,7 @@
Summary: The GNOME Display Manager
Name: gdm
Version: 2.23.92
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
License: GPLv2+
Group: User Interface/X
@ -79,6 +79,7 @@ BuildRequires: libxklavier-devel
Requires: audit-libs >= %{libauditver}
Patch1: xkb-groups.patch
Patch2: gdm-2.23.92-force-active-vt.patch
# Fedora-specific
Patch99: gdm-2.23.1-fedora-logo.patch
@ -101,6 +102,7 @@ multiple simulanteous logged in users.
%prep
%setup -q
%patch1 -p1 -b .xkb-groups
%patch2 -p1 -b .force-active-vt
%patch99 -p1 -b .fedora-logo
autoreconf
@ -293,6 +295,7 @@ fi
%attr(1770, root, gdm) %dir %{_localstatedir}/gdm
%attr(1770, root, gdm) %dir %{_localstatedir}/lib/gdm
%attr(1777, root, gdm) %dir %{_localstatedir}/run/gdm
%attr(1770, root, gdm) %dir %{_localstatedir}/spool/gdm
%files user-switch-applet
%defattr(-, root, root)
@ -301,6 +304,9 @@ fi
%{_datadir}/gnome-2.0/ui/GNOME_FastUserSwitchApplet.xml
%changelog
* Thu Sep 11 2008 Ray Strode <rstrode@redhat.com> - 1:2.23.92-3
- Add hook to allow for plymouth transition
* Tue Sep 9 2008 Jon McCann <jmccann@redhat.com> - 1:2.23.92-2
- Disallow root login