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

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