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

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