Blame SOURCES/0001-utils-add-new-gdm-disable-wayland-binary.patch

7b586f
From 14656db42a6b4d4d48cf74127f3187dfe85607ec Mon Sep 17 00:00:00 2001
7b586f
From: Ray Strode <rstrode@redhat.com>
7b586f
Date: Mon, 21 May 2018 15:03:29 +0000
7b586f
Subject: [PATCH] utils: add new gdm-disable-wayland binary
7b586f
7b586f
We currently disable wayland for cirrus by calling printf
7b586f
from a udev rule.  This works, but it's a little too open
7b586f
coded to easily write SELinux policy for.
7b586f
7b586f
This commit introduces a new program, gdm-disable-wayland,
7b586f
that does the same thing, but in a dedicated binary.
7b586f
7b586f
A future commit will change the udev rule to use the binary.
7b586f
7b586f
https://bugzilla.gnome.org/show_bug.cgi?id=796315
7b586f
7b586f
7b586f
(cherry picked from commit 2dc57da31781dedfe374ce353b0f5fd6aa9da56f)
7b586f
---
7b586f
 utils/Makefile.am           | 14 ++++++++++
7b586f
 utils/gdm-disable-wayland.c | 53 +++++++++++++++++++++++++++++++++++++
7b586f
 2 files changed, 67 insertions(+)
7b586f
 create mode 100644 utils/gdm-disable-wayland.c
7b586f
7b586f
diff --git a/utils/Makefile.am b/utils/Makefile.am
7b586f
index ae3cc01fb..babe890b9 100644
7b586f
--- a/utils/Makefile.am
7b586f
+++ b/utils/Makefile.am
7b586f
@@ -1,56 +1,70 @@
7b586f
 NULL =
7b586f
 
7b586f
 AM_CPPFLAGS = \
7b586f
 	-I$(srcdir)					\
7b586f
 	-I$(builddir)					\
7b586f
 	-I$(top_srcdir)					\
7b586f
 	-I$(top_builddir)				\
7b586f
 	-I$(top_srcdir)/common				\
7b586f
 	-I$(top_builddir)/common			\
7b586f
 	-DDATADIR=\"$(datadir)\"			\
7b586f
 	-DGDMCONFDIR=\"$(gdmconfdir)\"			\
7b586f
 	-DLOCALSTATEDIR=\""$(localstatedir)"\" 		\
7b586f
+	-DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\"		\
7b586f
+	-DGDM_RUNTIME_CONF=\"$(GDM_RUNTIME_CONF)\"	\
7b586f
 	-DGDM_SCREENSHOT_DIR=\""$(GDM_SCREENSHOT_DIR)"\"\
7b586f
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" 	\
7b586f
 	$(UTILS_CFLAGS)					\
7b586f
 	$(CANBERRA_GTK_CFLAGS)				\
7b586f
 	$(GTK_CFLAGS)					\
7b586f
 	$(XLIB_CFLAGS)					\
7b586f
 	$(SYSTEMD_CFLAGS)				\
7b586f
 	$(COMMON_CFLAGS)				\
7b586f
 	$(NULL)
7b586f
 
7b586f
 edit = sed \
7b586f
 	-e 's|@sbindir[@]|$(sbindir)|g' \
7b586f
 	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
7b586f
 	-e 's|@localstatedir[@]|$(localstatedir)|g' \
7b586f
 	-e 's|@GDM_PID_FILE[@]|$(GDM_PID_FILE)|g'
7b586f
 
7b586f
 bin_PROGRAMS = \
7b586f
 	gdmflexiserver		\
7b586f
 	gdm-screenshot		\
7b586f
 	$(NULL)
7b586f
 
7b586f
+libexec_PROGRAMS = \
7b586f
+	gdm-disable-wayland	\
7b586f
+	$(NULL)
7b586f
+
7b586f
 gdmflexiserver_LDADD =		\
7b586f
 	$(top_builddir)/common/libgdmcommon.la	\
7b586f
 	$(GTK_LIBS)		\
7b586f
 	$(COMMON_LIBS)		\
7b586f
 	$(SYSTEMD_LIBS)         \
7b586f
 	$(NULL)
7b586f
 
7b586f
 gdm_screenshot_SOURCES =	\
7b586f
 	gdm-screenshot.c	\
7b586f
 	$(NULL)
7b586f
 
7b586f
 gdm_screenshot_LDADD =		\
7b586f
 	$(GTK_LIBS)		\
7b586f
 	$(CANBERRA_GTK_LIBS)	\
7b586f
 	$(XLIB_LIBS)		\
7b586f
 	$(COMMON_LIBS)		\
7b586f
 	$(NULL)
7b586f
 
7b586f
+gdm_disable_wayland_LDADD =	\
7b586f
+	$(COMMON_LIBS)		\
7b586f
+	$(NULL)
7b586f
+
7b586f
+gdm_disable_wayland_SOURCES =	\
7b586f
+	gdm-disable-wayland.c	\
7b586f
+	$(NULL)
7b586f
+
7b586f
 CLEANFILES = 			\
7b586f
 	$(NULL)
7b586f
 
7b586f
 DISTCLEANFILES = 		\
7b586f
 	$(NULL)
7b586f
diff --git a/utils/gdm-disable-wayland.c b/utils/gdm-disable-wayland.c
7b586f
new file mode 100644
7b586f
index 000000000..be61c4d8f
7b586f
--- /dev/null
7b586f
+++ b/utils/gdm-disable-wayland.c
7b586f
@@ -0,0 +1,53 @@
7b586f
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
7b586f
+ *
7b586f
+ * Copyright (C) 2018 Red Hat, Inc.
7b586f
+ *
7b586f
+ * This program is free software; you can redistribute it and/or modify
7b586f
+ * it under the terms of the GNU General Public License as published by
7b586f
+ * the Free Software Foundation; either version 2 of the License, or
7b586f
+ * (at your option) any later version.
7b586f
+ *
7b586f
+ * This program is distributed in the hope that it will be useful,
7b586f
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b586f
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7b586f
+ * GNU General Public License for more details.
7b586f
+ *
7b586f
+ * You should have received a copy of the GNU General Public License
7b586f
+ * along with this program; if not, write to the Free Software
7b586f
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7b586f
+ *
7b586f
+ */
7b586f
+
7b586f
+#include "config.h"
7b586f
+
7b586f
+#include <locale.h>
7b586f
+#include <stdlib.h>
7b586f
+#include <sysexits.h>
7b586f
+
7b586f
+#include <glib.h>
7b586f
+
7b586f
+int
7b586f
+main (int argc, char *argv[])
7b586f
+{
7b586f
+        g_autoptr(GKeyFile) key_file = NULL;
7b586f
+        g_autoptr(GError) error = NULL;
7b586f
+        gboolean saved_okay;
7b586f
+
7b586f
+        setlocale (LC_ALL, "");
7b586f
+
7b586f
+        key_file = g_key_file_new ();
7b586f
+
7b586f
+        g_key_file_set_boolean (key_file, "daemon", "WaylandEnable", FALSE);
7b586f
+
7b586f
+        g_mkdir_with_parents (GDM_RUN_DIR, 0711);
7b586f
+
7b586f
+        saved_okay = g_key_file_save_to_file (key_file, GDM_RUNTIME_CONF, &error);
7b586f
+
7b586f
+        if (!saved_okay) {
7b586f
+                g_printerr ("gdm-disable-wayland: unable to disable wayland: %s",
7b586f
+                            error->message);
7b586f
+                return EX_CANTCREAT;
7b586f
+        }
7b586f
+
7b586f
+        return EX_OK;
7b586f
+}
7b586f
-- 
7b586f
2.17.1
7b586f