Browse Source

xorg-x11-xinit: add flies

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@10989 ec354946-7b23-47d6-9f5a-488ba84defc7
iwaim 7 years ago
parent
commit
8938d34331

+ 127 - 0
x/xorg-x11-xinit/Xclients

@@ -0,0 +1,127 @@
+#!/bin/bash
+#                 by Jun Nishii <jun@vinelinux.org>
+#                 by Ryoichi INAGAKI <ryo1@bc.wakwak.com>
+#            Time-stamp: <2010-02-27 21:41:08 inagaki>
+
+msgfile="$HOME/.xwm.msgs"
+startWM(){
+    WM=$1
+    shift
+    CMD="$(type -p $1)"
+    shift
+    if [ -n "$CMD" ]; then
+        echo Starting $WM >>$msgfile
+	env > "$HOME"/Xrootenv.0
+	exec ${XSESSION_WRAPPER} $CMD $@ >>$msgfile 2>&1
+	return 0
+    fi
+    return -1
+}
+
+# First thing - check the user preferences
+if [ -f $HOME/.wm_style ] ; then
+    WMSTYLE=`cat $HOME/.wm_style`
+    case "$WMSTYLE" in 
+	gnome*|Gnome*|GNOME*)
+	    startWM Gnome gnome-session
+	    ;;
+	startkde*|kde*|KDE*)
+	    startWM KDE startkde
+	    ;;
+	startxfce4*|xfce*|XFce*|XFCE*)
+	    startWM XFce startxfce4
+	    ;;
+	startlxde*|lxde*|LXDE*)
+	    startWM lxde startlxde
+	    ;;
+	wmaker*|WindowMaker*)
+	    startWM WindowMaker RunWM --WindowMaker
+	    ;;
+ 	afterstep*|Afterstep*|AfterStep*)
+	    startWM AfterStep RunWM --AfterStep
+ 	    ;;
+ 	blackbox*|BlackBox*|BLACKBOX*)
+	    startWM BlackBox blackbox
+ 	    ;;
+ 	fluxbox*|FluxBox*|FLUXBOX*)
+	    startWM FluxBox startfluxbox
+ 	    ;;
+ 	icewm*|IceWm*|ICEWM*)
+	    startWM icewm icewm
+ 	    ;;
+        enlightenment*|Enlightenment*|ENLIGHT*)
+	    startWM Enlightenment enlightenment
+            ;;
+	sawfish*)
+	    startWM sawfish sawfish
+	    ;;
+	sawmill*)
+	    startWM sawmill sawmill
+	    ;;
+        qvwm*|QVWM*)
+	    startWM qvwm qvwm
+	    ;;
+	fvwm2*|FVWM2*)
+	    startWM fvwm2 fvwm2
+	    ;;
+	twm*|TWM*)
+	    startWM twm twm &&\
+                 exec kterm -C -title Login -n Login -sb -geometry 80x25-0-0 -ls
+            ;;
+	default*)
+	    startWM Gnome gnome-session
+	    ;;
+    esac
+fi
+
+GSESSION="$(type -p gnome-session)"
+STARTKDE="$(type -p startkde)"
+
+# check to see if the user has a preferred desktop
+PREFERRED=
+if [ -f /etc/sysconfig/desktop ]; then
+    . /etc/sysconfig/desktop
+    if [ "$DESKTOP" = "GNOME" ]; then
+	PREFERRED="$GSESSION"
+    elif [ "$DESKTOP" = "KDE" ]; then
+	PREFERRED="$STARTKDE"
+    elif [ -n "`grep -i AnotherLevel /etc/sysconfig/desktop`" ]; then
+	PREFERRED=AnotherLevel
+    elif [ -x /usr/bin/gnome-session ]; then
+        PREFERRED=gnome-session
+    fi
+fi
+
+if [ -n "$PREFERRED" -a "$PREFERRED" != "AnotherLevel" ] && \
+	which $PREFERRED >/dev/null 2>&1; then
+    PREFERRED=`which $PREFERRED`
+    exec ${XSESSION_WRAPPER} $PREFERRED
+fi
+
+# We should also support /etc/X11/xinit/Xclients.d scripts
+XCLIENTS_D=/etc/X11/xinit/Xclients.d
+if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
+    exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
+fi
+
+# Failsafe.
+
+# these files are left sitting around by TheNextLevel.
+rm -f $HOME/Xrootenv.0
+
+# Argh! Nothing good is isntalled. Fall back to fvwm2 (win95-style) or twm
+{
+    # fall back to failsafe settings
+    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
+
+    if [ -x /usr/bin/xclock ] ; then
+	/usr/bin/xclock -geometry 100x100-5+5 &
+    fi
+    if [ -x /usr/bin/kterm ] ; then
+	/usr/bin/kterm -geometry 80x50-50+150 &
+    fi
+    if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
+	/usr/bin/firefox /usr/share/doc/HTML/index.html &
+    fi
+    startWM fvwm2 fvwm2 || startWM twm twm
+}

+ 25 - 0
x/xorg-x11-xinit/Xmodmap

@@ -0,0 +1,25 @@
+! /etc/X11/Xmodmap
+!
+! global Xmodmap file -- used by both xdm and xinit (startx)
+
+! keycode and keysym remapping should generally be used only if the X
+! server config file has been configured to disable the XKEYBOARD
+! extension
+
+! i386 and alpha
+! keycode 22 = BackSpace
+! keycode 107 = Delete           
+
+! powerpc
+! keycode 59 = BackSpace
+! keycode 125 = Delete
+
+! sparc
+! keycode 50 = BackSpace
+! keycode 73 = Delete
+
+! Euro sign support
+! keycode 26 = e E currency
+! keycode 54 = c C cent
+! keycode 113 = Mode_switch Mode_switch Multi_key
+

+ 13 - 0
x/xorg-x11-xinit/Xresources

@@ -0,0 +1,13 @@
+! This is the global resources file that is loaded when
+! all users log in, as well as for the login screen
+
+! Fix the Xft dpi to 96; this prevents tiny fonts
+! or HUGE fonts depending on the screen size.
+Xft.dpi: 96
+
+! hintstyle: medium means that (for Postscript fonts) we
+! position the stems for maximum constrast and consistency
+! but do not force the stems to integral widths. hintnone,
+! hintslight, and hintfull are the other possibilities.
+Xft.hintstyle: hintmedium
+Xft.hinting: true

+ 93 - 0
x/xorg-x11-xinit/Xsession

@@ -0,0 +1,93 @@
+#!/bin/bash
+# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
+# copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the
+# GNU General Public License version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# redirect errors to a file in user's home directory if we can
+if [ -z "$GDMSESSION" ]; then
+    # GDM redirect output itself in a smarter fashion
+    errfile="$HOME/.xsession-errors"
+    if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ); then
+        chmod 600 "$errfile"
+        [ -x /sbin/restorecon ] && /sbin/restorecon $errfile
+        exec > "$errfile" 2>&1
+    else
+        errfile=$(mktemp -q /tmp/xses-$USER.XXXXXX)
+        if [ $? -eq 0 ]; then
+            exec > "$errfile" 2>&1
+        fi
+    fi
+fi
+
+SWITCHDESKPATH=/usr/share/switchdesk
+
+# Mandatorily source xinitrc-common, which is common code shared between the
+# Xsession and xinitrc scripts which has been factored out to avoid duplication
+. /etc/X11/xinit/xinitrc-common
+
+# This Xsession.d implementation, is intended to obsolte and replace the
+# various mechanisms present in the 'case' statement which follows, and to
+# eventually be able to easily remove all hard coded window manager specific
+# content from this script.  See bug #142260 for additional explanation and
+# details.  All window manager rpm packages and desktop environment
+# packages should be modified to provide the Xsession.d/Xsession.$wm scripts
+# to start themselves up.  In the future, the legacy switchdesk mechanisms
+# and hard coded window managers and desktop environments will be removed from
+# this script. 
+XCLIENTS_D=/etc/X11/xinit/Xclients.d
+if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
+    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
+else
+# now, we see if xdm/gdm/kdm has asked for a specific environment
+case $# in
+1)
+    if [ -x "$SWITCHDESKPATH/Xclients.$1" ]; then
+       exec -l $SHELL -c "$SWITCHDESKPATH/Xclients.$1";
+    fi;
+
+    case "$1" in
+	failsafe)
+	    exec -l $SHELL -c "xterm -geometry 80x24-0-0"
+	    ;;
+	gnome|gnome-session)
+	    # lack of SSH_AGENT is intentional, see #441123.  though
+	    # the whole thing should really happen in xinitrc.d anyway.
+	    exec -l $SHELL -c gnome-session
+	    exec /bin/sh -c "exec -l $SHELL -c \"gnome-session\"" 
+	    ;;
+	kde|kde1|kde2)
+	    exec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"startkde\""
+	    ;;
+	twm)
+        # fall back to twm
+	    exec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"twm\""
+	    ;;
+	*)
+       # GDM provies either a command line as the first argument or
+       # provides 'failsafe', 'default' or 'custom'.  KDM will do the
+       # same at some point
+	    if [ "$1" != "default" -a "$1" != "custom" ]; then
+		exec $CK_XINIT_SESSION $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$1\""
+	    fi
+	    ;;
+    esac
+esac
+fi
+
+# otherwise, take default action
+if [ -x "$HOME/.xsession" ]; then
+    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.xsession"
+elif [ -x "$HOME/.Xclients" ]; then
+    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients"
+elif [ -x /etc/X11/xinit/Xclients ]; then
+    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients"
+else
+    # should never get here; failsafe fallback
+    exec -l $SHELL -c "xsm"
+fi
+

+ 147 - 0
x/xorg-x11-xinit/ck-xinit-session.c

@@ -0,0 +1,147 @@
+/*
+ * Copyright Red Hat, Inc. 2007,2009.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of Red Hat, Inc., nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Gate a process inside of a ConsoleKit session.
+ *
+ * We want to do this instead of doing it from inside of xinit because at the
+ * point we're doing it, we've already added the user's UID to the list of
+ * allowed clients for the X server, so the ConsoleKit daemon, which assumes
+ * the user's UID, will be able to connect without needing to be able to read
+ * the user's X cookies.
+ */
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <ck-connector.h>
+#include <dbus/dbus.h>
+
+static void
+setbusenv(const char *var, const char *val)
+{
+	DBusConnection *conn;
+	DBusMessage *req, *rep;
+	DBusMessageIter iter, sub, subsub;
+	DBusError error;
+
+	dbus_error_init (&error);
+
+	conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
+	if (conn == NULL) {
+		return;
+	}
+
+	req = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
+	if (req == NULL) {
+		return;
+	}
+
+	memset(&iter, 0, sizeof(iter));
+	memset(&sub, 0, sizeof(sub));
+	memset(&subsub, 0, sizeof(subsub));
+	dbus_message_iter_init_append(req, &iter);
+	if (!dbus_message_set_destination(req, DBUS_SERVICE_DBUS) ||
+	    !dbus_message_set_path(req, DBUS_PATH_DBUS) ||
+	    !dbus_message_set_interface(req, DBUS_INTERFACE_DBUS) ||
+	    !dbus_message_set_member(req, "UpdateActivationEnvironment") ||
+	    !dbus_message_iter_open_container(&iter,
+					      DBUS_TYPE_ARRAY,
+					      DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+					      DBUS_TYPE_STRING_AS_STRING
+					      DBUS_TYPE_STRING_AS_STRING
+					      DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
+					      &sub) ||
+	    !dbus_message_iter_open_container(&sub,
+					      DBUS_TYPE_DICT_ENTRY,
+					      NULL,
+					      &subsub) ||
+	    !dbus_message_iter_append_basic(&subsub, DBUS_TYPE_STRING, &var) ||
+	    !dbus_message_iter_append_basic(&subsub, DBUS_TYPE_STRING, &val) ||
+	    !dbus_message_iter_close_container(&sub, &subsub) ||
+	    !dbus_message_iter_close_container(&iter, &sub)) {
+		dbus_message_unref(req);
+		return;
+	}
+	rep = dbus_connection_send_with_reply_and_block(conn, req,
+							30000, &error);
+	dbus_message_unref(req);
+	if (rep) {
+		dbus_message_unref(rep);
+	}
+}
+
+int
+main(int argc, char **argv)
+{
+	CkConnector *ckc = NULL;
+	DBusError error;
+	const char *shell, *cookie;
+	pid_t pid;
+	int status;
+
+	ckc = ck_connector_new();
+	if (ckc != NULL) {
+		dbus_error_init (&error);
+		if (ck_connector_open_session(ckc, &error)) {
+			pid = fork();
+			switch (pid) {
+			case -1:
+				syslog(LOG_ERR, "error forking child");
+				break;
+			case 0:
+				cookie = ck_connector_get_cookie(ckc);
+				setenv("XDG_SESSION_COOKIE", cookie, 1);
+				setbusenv("XDG_SESSION_COOKIE", cookie);
+				break;
+			default:
+				waitpid(pid, &status, 0);
+				exit(status);
+				break;
+			}
+		} else {
+			syslog(LOG_ERR, "error connecting to console-kit");
+		}
+	} else {
+		syslog(LOG_ERR, "error setting up to connect to console-kit");
+	}
+	if (argc > 1) {
+		execvp(argv[1], argv + 1);
+	} else {
+		shell = getenv("SHELL");
+		if (shell == NULL) {
+			shell = _PATH_BSHELL;
+		}
+		execlp(shell, shell, NULL);
+	}
+	_exit(1);
+}

+ 12 - 0
x/xorg-x11-xinit/localuser.sh

@@ -0,0 +1,12 @@
+#!/bin/sh
+# Copyright (C) 2006 Red Hat, Inc. All rights reserved. This
+# copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the
+# GNU General Public License version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+[ -x /usr/bin/xhost ] && [ -x /usr/bin/id ] &&
+    xhost +si:localuser:`id -un` >& /dev/null

+ 166 - 0
x/xorg-x11-xinit/xinit-1.0.7-poke-ck.patch

@@ -0,0 +1,166 @@
+diff -up xinit-1.0.7/xinit.c.poke-ck xinit-1.0.7/xinit.c
+--- xinit-1.0.7/xinit.c.poke-ck	2007-09-24 13:48:04.000000000 -0400
++++ xinit-1.0.7/xinit.c	2007-09-24 13:53:55.000000000 -0400
+@@ -1,3 +1,4 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ /* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
+ /* $XdotOrg: $ */
+ 
+@@ -39,6 +40,13 @@ in this Software without prior written a
+ #include <ctype.h>
+ #include <stdint.h>
+ 
++#define USE_CONKIT
++#ifdef USE_CONKIT
++#include <ck-connector.h>
++#include <X11/Xatom.h>
++static CkConnector *ckc = NULL;
++#endif /* USE_CONKIT */
++
+ #ifdef X_POSIX_C_SOURCE
+ #define _POSIX_C_SOURCE X_POSIX_C_SOURCE
+ #include <signal.h>
+@@ -521,6 +529,39 @@ processTimeout(int timeout, char *string
+ 	return( serverpid != pidfound );
+ }
+ 
++
++#ifdef USE_CONKIT
++static void
++register_new_session_with_console_kit (void)
++{
++	static char conkitbuf[256];
++	DBusError   error;
++
++	ckc = ck_connector_new ();
++	if (ckc == NULL) {
++		Error ("Cannot register with ConsoleKit: OOM creating CkConnector\n");
++		goto out;
++	}
++
++	dbus_error_init (&error);
++	if (!ck_connector_open_session (ckc, &error)) {
++		Error ("Cannot register with ConsoleKit: %s: %s\n", error.name, error.message);
++		goto out;
++	}
++
++	/* If we managed to register with ConsoleKit, put the
++	 * environment variable XDG_SESSION_COOKIE=cookie as second
++	 * element in newenviron. See set_environment() where we
++	 * earlier have made sure there is room...
++	 */
++	conkitbuf[sizeof (conkitbuf) - 1] = '\0';
++	snprintf (conkitbuf, sizeof (conkitbuf) - 1, "XDG_SESSION_COOKIE=%s", ck_connector_get_cookie (ckc));
++	newenviron[1] = conkitbuf;
++out:
++	;
++}
++#endif /* USE_CONKIT */
++
+ static int
+ startServer(char *server[])
+ {
+@@ -631,6 +672,12 @@ startServer(char *server[])
+ 		break;
+ 	}
+ 
++#ifdef USE_CONKIT
++	if (serverpid != -1 ) {
++		register_new_session_with_console_kit ();
++	}
++#endif /* USE_CONKIT */
++
+ 	return(serverpid);
+ }
+ 
+@@ -785,6 +832,13 @@ shutdown(void)
+ 				clientpid);
+ 	}
+ 
++#ifdef USE_CONKIT
++	if (ckc != NULL) {
++		ck_connector_unref (ckc);
++		ckc = NULL;
++	}
++#endif
++
+ 	if (serverpid < 0)
+ 		return;
+ 	errno = 0;
+@@ -821,6 +875,13 @@ shutdown(void)
+  * make a new copy of environment that has room for DISPLAY
+  */
+ 
++
++#ifdef USE_CONKIT
++#define NUM_EXTRA_ENV_VARS 3
++#else
++#define NUM_EXTRA_ENV_VARS 2
++#endif
++
+ static void 
+ set_environment(void)
+ {
+@@ -832,11 +893,11 @@ set_environment(void)
+     for (oldPtr = environ; *oldPtr; oldPtr++) ;
+ 
+     nenvvars = (oldPtr - environ);
+-    newenviron = (char **) malloc ((nenvvars + 3) * sizeof(char **));
++    newenviron = (char **) malloc ((nenvvars + NUM_EXTRA_ENV_VARS) * sizeof(char **));
+     if (!newenviron) {
+ 	fprintf (stderr,
+ 		 "%s:  unable to allocate %d pointers for environment\n",
+-		 program, nenvvars + 3);
++		 program, nenvvars + NUM_EXTRA_ENV_VARS);
+ 	exit (1);
+     }
+ 
+@@ -846,10 +907,19 @@ set_environment(void)
+     newPtr = newenviron;
+     *newPtr++ = displaybuf;
+ 
++#ifdef USE_CONKIT
++    *newPtr++ = "XDG_SESSION_COOKIE=";
++#endif
++
+     /* copy pointers to other variables */
+     for (oldPtr = environ; *oldPtr; oldPtr++) {
+ 	if (strncmp (*oldPtr, "DISPLAY=", 8) != 0
+-	 && strncmp (*oldPtr, "WINDOWPATH=", 11) != 0) {
++	 && strncmp (*oldPtr, "WINDOWPATH=", 11) != 0
++#ifdef USE_CONKIT
++	 && strncmp (*oldPtr, "XDG_SESSION_COOKIE=", 19) != 0
++#endif
++	 )
++	{
+ 	    *newPtr++ = *oldPtr;
+ 	}
+     }
+diff -up xinit-1.0.7/configure.ac.poke-ck xinit-1.0.7/configure.ac
+--- xinit-1.0.7/configure.ac.poke-ck	2007-09-17 06:46:38.000000000 -0400
++++ xinit-1.0.7/configure.ac	2007-09-24 13:48:04.000000000 -0400
+@@ -92,7 +92,7 @@ AC_ARG_WITH(xinit,
+ 	[XINIT="$DEFAULT_XINIT"])
+ 
+ # Checks for pkg-config packages
+-PKG_CHECK_MODULES(XINIT, x11)
++PKG_CHECK_MODULES(XINIT, x11 ck-connector)
+ 
+ case $host_os in
+     *bsd*)
+diff -up xinit-1.0.7/startx.cpp.poke-ck xinit-1.0.7/startx.cpp
+--- xinit-1.0.7/startx.cpp.poke-ck	2007-09-16 17:24:48.000000000 -0400
++++ xinit-1.0.7/startx.cpp	2007-09-24 13:48:04.000000000 -0400
+@@ -223,6 +223,12 @@ EOF
+     fi
+ done
+ 
++if [ x"$display" != x ]; then
++    export DISPLAY=$display
++else
++    export DISPLAY=:0
++fi
++
+ #if defined(__SCO__) || defined(__UNIXWARE__)
+ if [ "$REMOTE_SERVER" = "TRUE" ]; then
+         exec SHELL_CMD ${client}

+ 11 - 0
x/xorg-x11-xinit/xinit-1.0.9-unset.patch

@@ -0,0 +1,11 @@
+diff -up xinit-1.0.9/startx.cpp.jx xinit-1.0.9/startx.cpp
+--- xinit-1.0.9/startx.cpp.jx	2008-05-21 14:29:51.000000000 -0400
++++ xinit-1.0.9/startx.cpp	2009-05-08 13:46:44.000000000 -0400
+@@ -13,6 +13,7 @@ XCOMM Site administrators are STRONGLY u
+ XCOMM
+ XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
+ 
++unset XDG_SESSION_COOKIE
+ unset DBUS_SESSION_BUS_ADDRESS
+ unset SESSION_MANAGER
+ 

+ 38 - 0
x/xorg-x11-xinit/xinit-1.3.4-client-session.patch

@@ -0,0 +1,38 @@
+--- xinit-1.3.4/xinit.c.client-session	2014-03-25 18:20:26.000000000 +0900
++++ xinit-1.3.4/xinit.c	2014-11-22 20:11:16.301390109 +0900
+@@ -89,6 +89,7 @@ char xserverrcbuf[256];
+ 
+ #define TRUE 1
+ #define FALSE 0
++#define ERR_EXIT 1
+ 
+ static char *default_server = "X";
+ static char *default_display = ":0";        /* choose most efficient */
+@@ -560,6 +561,7 @@ startClient(char *client_argv[])
+ {
+     clientpid = fork();
+     if (clientpid == 0) {
++		int fd;
+         set_environment();
+         setWindowPath();
+ 
+@@ -567,7 +569,18 @@ startClient(char *client_argv[])
+             Error("cannot change uid");
+             _exit(EXIT_FAILURE);
+         }
+-        setpgid(0, getpid());
++
++		fd = open ("/dev/null", O_RDONLY);
++
++		if (fd < 0) {
++			Error("cannot open /dev/null: %s\n", strerror(errno));
++			_exit(ERR_EXIT);
++		}
++		close (STDIN_FILENO);
++		dup2 (fd, STDIN_FILENO);
++		close (fd);
++		setsid();
++
+         Execute(client_argv);
+         Error("Unable to run program \"%s\"", client_argv[0]);
+ 

+ 11 - 0
x/xorg-x11-xinit/xinit-1.3.4-vine.patch

@@ -0,0 +1,11 @@
+--- xinit-1.3.4/startx.cpp.vine	2014-09-12 02:31:42.000000000 +0900
++++ xinit-1.3.4/startx.cpp	2014-11-22 20:13:52.655650111 +0900
+@@ -58,7 +58,7 @@ defaultclientargs=""
+ defaultserverargs=""
+ defaultdisplay=":0"
+ clientargs=""
+-serverargs=""
++serverargs="-dpi 96 -nolisten tcp"
+ vtarg=""
+ 
+ #ifdef __APPLE__

+ 4 - 0
x/xorg-x11-xinit/xinit-compat.desktop

@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=User script
+Comment=This session runs ~/.xsession or ~/.Xclients if available
+Exec=sh -c "exec ~/.xsession || exec ~/.Xclients || exec /etc/X11/xinit/Xclients"

+ 33 - 0
x/xorg-x11-xinit/xinitrc

@@ -0,0 +1,33 @@
+#!/bin/sh
+# Copyright (C) 1999 - 2005 Red Hat, Inc. All rights reserved. This
+# copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the
+# GNU General Public License version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Authors:
+#	Mike A. Harris <mharris@redhat.com>
+
+# Mandatorily source xinitrc-common, which is common code shared between the
+# Xsession and xinitrc scripts which has been factored out to avoid duplication
+. /etc/X11/xinit/xinitrc-common
+
+# The user may have their own clients they want to run.  If they don't,
+# fall back to system defaults.
+if [ -f $HOME/.Xclients ]; then
+    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients || \
+    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients
+elif [ -f /etc/X11/xinit/Xclients ]; then
+    exec $CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients || \
+    exec $CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients
+else
+    # Failsafe settings.  Although we should never get here
+    # (we provide fallbacks in Xclients as well) it can't hurt.
+    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
+    [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 &
+    [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 &
+    [ -x /usr/bin/twm ] && /usr/bin/twm
+fi

+ 69 - 0
x/xorg-x11-xinit/xinitrc-common

@@ -0,0 +1,69 @@
+# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
+# copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the
+# GNU General Public License version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# xinitrc-common
+#
+# This is common code shared by both Xsession and xinitrc scripts.  Be sure
+# to take this into account when fixing bugs or adding new functionality.
+
+# Set up i18n environment
+if [ -r /etc/profile.d/lang.sh ]; then
+  . /etc/profile.d/lang.sh
+fi
+
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+userxkbmap=$HOME/.Xkbmap
+
+sysresources=/etc/X11/Xresources
+sysmodmap=/etc/X11/Xmodmap
+sysxkbmap=/etc/X11/Xkbmap
+
+# merge in defaults
+[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
+[ -r "$userresources" ] && xrdb -merge "$userresources"
+
+# merge in keymaps
+if [ -r "$sysxkbmap" ]; then
+    setxkbmap $(cat "$sysxkbmap")
+    XKB_IN_USE=yes
+fi
+
+if [ -r "$userxkbmap" ]; then
+    setxkbmap $(cat "$userxkbmap")
+    XKB_IN_USE=yes
+fi
+
+# xkb and xmodmap don't play nice together
+if [ -z "$XKB_IN_USE" ]; then
+    [ -r "$sysmodmap" ] && xmodmap "$sysmodmap"
+    [ -r "$usermodmap" ] && xmodmap "$usermodmap"
+fi
+
+unset XKB_IN_USE
+
+# run all system xinitrc shell scripts.
+for file in /etc/X11/xinit/xinitrc.d/* ; do
+        . $file
+done
+
+# Prefix launch of session with ssh-agent if available and not already running.
+SSH_AGENT=
+if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]; then
+    if [ "x$TMPDIR" != "x" ]; then
+        SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
+    else
+        SSH_AGENT="/usr/bin/ssh-agent"
+  fi
+fi
+
+CK_XINIT_SESSION=
+if [ -z "$XDG_SESSION_COOKIE" ] && [ -x /usr/bin/ck-xinit-session ]; then
+    CK_XINIT_SESSION="/usr/bin/ck-xinit-session"
+fi