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

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