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

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