summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Cardona <remi@gentoo.org>2009-10-03 09:59:43 +0200
committerRémi Cardona <remi@gentoo.org>2009-10-03 12:17:17 +0200
commit4a35f648fe0ca42562c28c176e5d637c4cb01a7c (patch)
tree37e2965aed939e061d640ab3acc7d12f08353062 /x11-apps/xinit
parentx11-base/xorg-server-1.7.0: Fix bug 287042 (diff)
downloadx11-4a35f648fe0ca42562c28c176e5d637c4cb01a7c.tar.gz
x11-4a35f648fe0ca42562c28c176e5d637c4cb01a7c.tar.bz2
x11-4a35f648fe0ca42562c28c176e5d637c4cb01a7c.zip
x11-apps/xinit: import from portage
Diffstat (limited to 'x11-apps/xinit')
-rw-r--r--x11-apps/xinit/Manifest13
-rwxr-xr-xx11-apps/xinit/files/Xsession107
-rwxr-xr-xx11-apps/xinit/files/chooser.sh61
-rw-r--r--x11-apps/xinit/files/gentoo-startx-customization-1.0.8.patch151
-rw-r--r--x11-apps/xinit/files/nolisten-tcp-and-black-background.patch12
-rwxr-xr-xx11-apps/xinit/files/startDM.sh30
-rw-r--r--x11-apps/xinit/files/xdm-setup.initd-114
-rw-r--r--x11-apps/xinit/files/xdm.confd-112
-rwxr-xr-xx11-apps/xinit/files/xdm.initd-3202
-rw-r--r--x11-apps/xinit/files/xinit-1.0.4-console-kit.patch197
-rw-r--r--x11-apps/xinit/files/xinitrc50
-rw-r--r--x11-apps/xinit/files/xserver.pamd5
-rw-r--r--x11-apps/xinit/xinit-1.0.8-r8.ebuild77
13 files changed, 931 insertions, 0 deletions
diff --git a/x11-apps/xinit/Manifest b/x11-apps/xinit/Manifest
new file mode 100644
index 00000000..2a6b0759
--- /dev/null
+++ b/x11-apps/xinit/Manifest
@@ -0,0 +1,13 @@
+AUX Xsession 2187 RMD160 ffb290e9a8656b17d7744797456a45df53cafd79 SHA1 8ba8de5114871f8500f428a03f87a42714d0ce14 SHA256 bdf2cceaafb71762bc1c6491f9bd8cc24089dea7ef65b0a030acadf7f4aa4ab3
+AUX chooser.sh 1496 RMD160 4d474c23dc10f2f33006885305002df7fd3197f9 SHA1 7e8f6a8238add6a1501964821d0b3ffd1ad92b80 SHA256 70bde060d86c313b90ab21a8eb9b101b08637297a1a5b4dec13e1c305ec4d1e8
+AUX gentoo-startx-customization-1.0.8.patch 3953 RMD160 cf0bc0b1439437b8a92a1f569445e8fbef1bb1cd SHA1 8020676fe7c9a2fed0c2a09cea0c273984a3cdc0 SHA256 29d6a004240672b86d6cc34e9cab5dcc88abcb84974d98b1085a9eb0dc852f38
+AUX nolisten-tcp-and-black-background.patch 381 RMD160 f767995059b6b3826e662ad71fd9348609383dc2 SHA1 8210062a9e3bac93e9d5b0a18633e6a98a6829f4 SHA256 481252dd205a0eefcfdf1a265b2c359280363ceaf1460ca5eab42b9eb3b3c826
+AUX startDM.sh 858 RMD160 d7ef866ddd09e3d4117b3363aaa6382a9b8cd153 SHA1 1b826dfb4d5a184d6d7cc1995d685b55c9c188ac SHA256 a7aca1e37e5b8fecb49aa96c4e2850547a47e154edabcdbd1cfcb8ab49337549
+AUX xdm-setup.initd-1 339 RMD160 8be48225ea6df9434d78981437cdbfdd29e10055 SHA1 15e723b54c27a422e9d53b98b3c5471e111817c2 SHA256 bce5865e7da9bcedeef66e8ce1b6fc7e303cf8d1f44ecb0e6347c045414a7d7d
+AUX xdm.confd-1 722 RMD160 3a4f800a37935e711112ede9c847837104e4100f SHA1 d3b2551ec7be8e5cfa42cc14e1d47ab37ac9f116 SHA256 1f6a2bb28e499698bbdba825d6dcbc81622579b1cf5c9e33538b252d254935c3
+AUX xdm.initd-3 5378 RMD160 a8f0f0dd7687c35d1c56dad074efd67624195d23 SHA1 307c4a46036ad63a09c2ccb69fc0d2c65ba5ab4f SHA256 59961db339fa8316802b1712ae306da529d50eae25419b0ef0a78735ea8ee323
+AUX xinit-1.0.4-console-kit.patch 4956 RMD160 286437f158d6a9ec588377b01d2b336d391bff37 SHA1 8d1ef61ec11bdf0308474560f0ed5156a6714d5f SHA256 65fd0800ccdecca979c8943755c5656fd022b54a160b32489ad95495521949e4
+AUX xinitrc 1059 RMD160 3f3ae64f6056055d3d42e471a5dd4263aa1b66db SHA1 edd6919448086273a73b1de897afe93e01b046c8 SHA256 53871c9c3198b38d73b08da3837d1331240a5d45e987a5b8135e7116c02d8eff
+AUX xserver.pamd 125 RMD160 4b75f8bf5e68ac7181a22beaccc153ac250eb8e9 SHA1 e35845021328044659036b9f82a95c17f21beb25 SHA256 f179c3417b94295fe12776f9da4a08898a3ee4199e26abff6457717caeb29bb2
+DIST xinit-1.0.8.tar.bz2 117049 RMD160 d01b299e6e96c2b5318aaec479c81670b94e2129 SHA1 0102d2fdc0df3d24077ba826cf57640da46140af SHA256 06c1049f6b63d1c368a1e03e2392097919b22ff24899e190de3577bffe6fe524
+EBUILD xinit-1.0.8-r8.ebuild 2214 RMD160 a610d99e614ffde7a44f1e6eae999c63dba16fcd SHA1 6e1c178895c4abde928672e0a58264b0b28e4b6e SHA256 29bad6c1a8ff3026750f8aba7b58b48256a35e0310b82fe1f80046de9e37bafe
diff --git a/x11-apps/xinit/files/Xsession b/x11-apps/xinit/files/Xsession
new file mode 100755
index 00000000..c86ccee1
--- /dev/null
+++ b/x11-apps/xinit/files/Xsession
@@ -0,0 +1,107 @@
+#!/bin/sh
+# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
+
+case $# in
+1)
+ case $1 in
+ failsafe)
+ exec xterm -geometry 80x24-0-0
+ ;;
+ esac
+esac
+
+# redirect errors to a file in user's home directory if we can
+for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
+do
+ if ( cp /dev/null "$errfile" 2> /dev/null )
+ then
+ chmod 600 "$errfile"
+ exec > "$errfile" 2>&1
+ break
+ fi
+done
+
+# clean up after xbanner
+if which freetemp 2> /dev/null ; then
+ freetemp
+fi
+
+startup=$HOME/.xsession
+
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+userxkbmap=$HOME/.Xkbmap
+
+sysresources=/etc/X11/Xresources
+sysmodmap=/etc/X11/Xmodmap
+sysxkbmap=/etc/X11/Xkbmap
+
+rh6sysresources=/etc/X11/xinit/Xresources
+rh6sysmodmap=/etc/X11/xinit/Xmodmap
+
+
+# merge in defaults
+if [ -f "$rh6sysresources" ]; then
+ xrdb -merge "$rh6sysresources"
+fi
+
+if [ -f "$sysresources" ]; then
+ xrdb -merge "$sysresources"
+fi
+
+if [ -f "$userresources" ]; then
+ xrdb -merge "$userresources"
+fi
+
+# merge in keymaps
+if [ -f "$sysxkbmap" ]; then
+ setxkbmap `cat "$sysxkbmap"`
+ XKB_IN_USE=yes
+fi
+
+if [ -f "$userxkbmap" ]; then
+ setxkbmap `cat "$userxkbmap"`
+ XKB_IN_USE=yes
+fi
+
+#
+# Eeek, this seems like too much magic here
+#
+if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
+ if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
+ xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
+ if [ -n "$xkbsymbols" ]; then
+ setxkbmap -symbols "$xkbsymbols"
+ XKB_IN_USE=yes
+ fi
+ fi
+fi
+
+# xkb and xmodmap don't play nice together
+if [ -z "$XKB_IN_USE" ]; then
+ if [ -f "$rh6sysmodmap" ]; then
+ xmodmap "$rh6sysmodmap"
+ fi
+
+ if [ -f "$sysmodmap" ]; then
+ xmodmap "$sysmodmap"
+ fi
+
+ if [ -f "$usermodmap" ]; then
+ xmodmap "$usermodmap"
+ fi
+fi
+
+unset XKB_IN_USE
+
+if [ -x "$startup" ]; then
+ exec "$startup"
+elif [ -x "$HOME/.Xclients" ]; then
+ exec "$HOME/.Xclients"
+elif [ -x /etc/X11/xinit/Xclients ]; then
+ exec /etc/X11/xinit/Xclients
+elif [ -x /etc/X11/Xclients ]; then
+ exec /etc/X11/Xclients
+else
+ exec xsm
+fi
diff --git a/x11-apps/xinit/files/chooser.sh b/x11-apps/xinit/files/chooser.sh
new file mode 100755
index 00000000..b2215360
--- /dev/null
+++ b/x11-apps/xinit/files/chooser.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# Author: Martin Schlemmer <azarah@gentoo.org>
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/chooser.sh,v 1.4 2006/09/05 23:22:13 dberkholz Exp $
+
+# If $XSESSION is "", source first /etc/conf.d/basic, and then /etc/rc.conf
+if [ -z "${XSESSION}" ]
+then
+ [ -f /etc/conf.d/basic ] && . /etc/conf.d/basic
+ [ -f /etc/rc.conf ] && . /etc/rc.conf
+fi
+
+# Find a match for $XSESSION in /etc/X11/Sessions
+GENTOO_SESSION=""
+for x in /etc/X11/Sessions/*
+do
+ if [ "`echo ${x##*/} | awk '{ print toupper($1) }'`" \
+ = "`echo ${XSESSION} | awk '{ print toupper($1) }'`" ]
+ then
+ GENTOO_SESSION=${x}
+ break
+ fi
+done
+
+GENTOO_EXEC=""
+
+if [ -n "${XSESSION}" ]; then
+ if [ -f /etc/X11/Sessions/${XSESSION} ]; then
+ if [ -x /etc/X11/Sessions/${XSESSION} ]; then
+ GENTOO_EXEC="/etc/X11/Sessions/${XSESSION}"
+ else
+ GENTOO_EXEC="/bin/sh /etc/X11/Sessions/${XSESSION}"
+ fi
+ elif [ -n "${GENTOO_SESSION}" ]; then
+ if [ -x "${GENTOO_SESSION}" ]; then
+ GENTOO_EXEC="${GENTOO_SESSION}"
+ else
+ GENTOO_EXEC="/bin/sh ${GENTOO_SESSION}"
+ fi
+ else
+ x=""
+ y=""
+
+ for x in "${XSESSION}" \
+ "`echo ${XSESSION} | awk '{ print toupper($1) }'`" \
+ "`echo ${XSESSION} | awk '{ print tolower($1) }'`"
+ do
+ # Fall through ...
+ if [ -x "`which ${x} 2>/dev/null`" ]; then
+ GENTOO_EXEC="`which ${x} 2>/dev/null`"
+ break
+ fi
+ done
+ fi
+fi
+
+echo "${GENTOO_EXEC}"
+
+
+# vim:ts=4
diff --git a/x11-apps/xinit/files/gentoo-startx-customization-1.0.8.patch b/x11-apps/xinit/files/gentoo-startx-customization-1.0.8.patch
new file mode 100644
index 00000000..c78283d8
--- /dev/null
+++ b/x11-apps/xinit/files/gentoo-startx-customization-1.0.8.patch
@@ -0,0 +1,151 @@
+diff -urN xinit-1.0.8.orig/startx.cpp xinit-1.0.8/startx.cpp
+--- xinit-1.0.8.orig/startx.cpp 2008-03-08 21:26:55.000000000 -0800
++++ xinit-1.0.8/startx.cpp 2008-03-08 21:27:32.000000000 -0800
+@@ -71,8 +71,6 @@
+
+ userserverrc=$HOME/.xserverrc
+ sysserverrc=XINITDIR/xserverrc
+-defaultclient=XTERM
+-defaultserver=XSERVER
+ defaultclientargs=""
+ defaultserverargs="-nolisten tcp -br"
+ clientargs=""
+@@ -158,63 +156,44 @@
+ whoseargs="client"
+ while [ x"$1" != x ]; do
+ case "$1" in
+- XCOMM '' required to prevent cpp from treating "/*" as a C comment.
+- /''*|\./''*)
+- if [ "$whoseargs" = "client" ]; then
+- if [ x"$clientargs" = x ]; then
+- client="$1"
+- else
+- clientargs="$clientargs $1"
+- fi
+- else
+- if [ x"$serverargs" = x ]; then
+- server="$1"
+- else
+- serverargs="$serverargs $1"
+- fi
+- fi
+- ;;
+- --)
+- whoseargs="server"
+- ;;
+- *)
+- if [ "$whoseargs" = "client" ]; then
+- clientargs="$clientargs $1"
+- else
+- XCOMM display must be the FIRST server argument
+- if [ x"$serverargs" = x ] && @@
+- expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
+- display="$1"
+- else
+- serverargs="$serverargs $1"
+- fi
+- fi
+- ;;
++ /''*|\.*) if [ "$whoseargs" = "client" ]; then
++ if [ "x$clientargs" = x ]; then
++ clientargs="$1"
++ else
++ clientargs="$clientargs $1"
++ fi
++ else
++ if [ "x$serverargs" = x ]; then
++ serverargs="$1"
++ else
++ serverargs="$serverargs $1"
++ fi
++ fi ;;
++ --) whoseargs="server" ;;
++ *) if [ "$whoseargs" = "client" ]; then
++ if [ "x$clientargs" = x ]; then
++ clientargs="$defaultclientargs $1"
++ else
++ clientargs="$clientargs $1"
++ fi
++ else
++ case "$1" in
++ :[0-9]*) display="$1"; serverargs="$serverargs $1";;
++ *) serverargs="$serverargs $1" ;;
++ esac
++ fi ;;
+ esac
+ shift
+ done
+
+-XCOMM process client arguments
+-if [ x"$client" = x ]; then
+- XCOMM if no client arguments either, use rc file instead
+- if [ x"$clientargs" = x ]; then
+- client="$defaultclientargs"
+- else
+- client=$defaultclient
+- fi
++if [ x"$clientargs" = x ]; then
++ clientargs="$defaultclientargs"
+ fi
+-
+-XCOMM process server arguments
+-if [ x"$server" = x ]; then
+- XCOMM if no server arguments or display either, use rc file instead
+- if [ x"$serverargs" = x -a x"$display" = x ]; then
+- server="$defaultserverargs"
++if [ x"$serverargs" = x ]; then
++ serverargs="$defaultserverargs"
+ #ifdef __APPLE__
+ display="$defaultdisplay"
+ #endif
+- else
+- server=$defaultserver
+- fi
+ fi
+
+ if [ x"$enable_xauth" = x1 ] ; then
+@@ -279,15 +258,8 @@
+ done
+ fi
+
+-#if defined(__SCO__) || defined(__UNIXWARE__)
+-if [ "$REMOTE_SERVER" = "TRUE" ]; then
+- exec SHELL_CMD ${client}
+-else
+- XINIT $client $clientargs -- $server $display $serverargs
+-fi
+-#else
+-XINIT $client $clientargs -- $server $display $serverargs
+-#endif
++cleanup() {
++ [ -n "$PID" ] && kill $PID > /dev/null 2>&1
+
+ if [ x"$enable_xauth" = x1 ] ; then
+ if [ x"$removelist" != x ]; then
+@@ -315,3 +287,15 @@
+ #if defined(sun)
+ kbd_mode -a
+ #endif
++}
++
++
++trap cleanup 0
++
++xinit $clientargs -- $serverargs -deferglyphs 16 &
++
++PID=$!
++
++wait $PID
++
++unset PID
+diff -urN xinit-1.0.8.orig/xinit.c xinit-1.0.8/xinit.c
+--- xinit-1.0.8.orig/xinit.c 2008-03-08 21:26:55.000000000 -0800
++++ xinit-1.0.8/xinit.c 2008-03-08 21:27:06.000000000 -0800
+@@ -479,6 +479,7 @@
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGPIPE, &sa, NULL);
++ sigaction(SIGTERM, &sa, NULL);
+
+ signal(SIGALRM, sigAlarm);
+ signal(SIGUSR1, sigUsr1);
diff --git a/x11-apps/xinit/files/nolisten-tcp-and-black-background.patch b/x11-apps/xinit/files/nolisten-tcp-and-black-background.patch
new file mode 100644
index 00000000..ab7f9600
--- /dev/null
+++ b/x11-apps/xinit/files/nolisten-tcp-and-black-background.patch
@@ -0,0 +1,12 @@
+diff -urN xinit-0.99.0/startx.cpp xinit-0.99.0/startx.cpp
+--- xinit-0.99.0/startx.cpp 2003-09-15 04:24:58.000000000 -0400
++++ xinit-0.99.0/startx.cpp 2003-09-15 04:28:50.000000000 -0400
+@@ -53,7 +53,7 @@
+ sysclientrc=XINITDIR/xinitrc
+ sysserverrc=XINITDIR/xserverrc
+ defaultclientargs=""
+-defaultserverargs=""
++defaultserverargs="-nolisten tcp -br"
+ clientargs=""
+ serverargs=""
+
diff --git a/x11-apps/xinit/files/startDM.sh b/x11-apps/xinit/files/startDM.sh
new file mode 100755
index 00000000..9775b07f
--- /dev/null
+++ b/x11-apps/xinit/files/startDM.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/startDM.sh,v 1.4 2007/04/05 15:30:19 uberlord Exp $
+
+# We need to source /etc/profile for stuff like $LANG to work
+# bug #10190.
+. /etc/profile
+
+. /etc/init.d/functions.sh
+
+# baselayout-1 compat
+if ! type get_options >/dev/null 2>/dev/null ; then
+ [ -r "${svclib}"/sh/rc-services.sh ] && . "${svclib}"/sh/rc-services.sh
+fi
+
+# Great new Gnome2 feature, AA
+# We enable this by default
+export GDK_USE_XFT=1
+
+export SVCNAME=xdm
+EXEC="$(get_options service)"
+NAME="$(get_options name)"
+PIDFILE="$(get_options pidfile)"
+
+start-stop-daemon --start --exec ${EXEC} \
+${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} || \
+eerror "ERROR: could not start the Display Manager"
+
+# vim:ts=4
diff --git a/x11-apps/xinit/files/xdm-setup.initd-1 b/x11-apps/xinit/files/xdm-setup.initd-1
new file mode 100644
index 00000000..79797a4f
--- /dev/null
+++ b/x11-apps/xinit/files/xdm-setup.initd-1
@@ -0,0 +1,14 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/xdm-setup.initd-1,v 1.5 2009/09/24 17:07:56 williamh Exp $
+
+depend() {
+ need localmount
+}
+
+start() {
+ if get_bootparam "nox" ; then
+ touch /tmp/.noxdm
+ fi
+}
diff --git a/x11-apps/xinit/files/xdm.confd-1 b/x11-apps/xinit/files/xdm.confd-1
new file mode 100644
index 00000000..aa1219e0
--- /dev/null
+++ b/x11-apps/xinit/files/xdm.confd-1
@@ -0,0 +1,12 @@
+# We always try and start X on a static VT. The various DMs normally default
+# to using VT7. If you wish to use the xdm init script, then you should ensure
+# that the VT checked is the same VT your DM wants to use. We do this check to
+# ensure that you have't accidently configured something to run on the VT
+# in your /etc/inittab file so that you don't get a dead keyboard.
+CHECKVT=7
+
+# What display manager do you use ? [ xdm | gdm | kdm | kdm-3.5 | kdm-4.0 | gpe | entrance ]
+# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
+# KDE-specific note: kdm-3.5 and kdm-4.0 are just examples. You will find all
+# possible versions by looking at the directories in /usr/kde/.
+DISPLAYMANAGER="xdm"
diff --git a/x11-apps/xinit/files/xdm.initd-3 b/x11-apps/xinit/files/xdm.initd-3
new file mode 100755
index 00000000..be0337d3
--- /dev/null
+++ b/x11-apps/xinit/files/xdm.initd-3
@@ -0,0 +1,202 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/xdm.initd-3,v 1.5 2009/09/24 17:07:56 williamh Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem: if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2. When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+# x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel. Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+
+# Start X Font Server before X
+depend() {
+ need localmount xdm-setup
+
+ # this should start as early as possible
+ # we can't do 'before *' as that breaks it
+ # (#139824) Start after ypbind and autofs for network authentication
+ # (#145219 #180163) Could use lirc mouse as input device
+ # (#70689 comment #92) Start after consolefont to avoid display corruption
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ before alsasound
+
+ # Start before X
+ use acpid consolekit hald xfs
+}
+
+setup_dm() {
+ local MY_XDM="$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')"
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH="${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")"
+
+ case "${MY_XDM}" in
+ kdm|kde|kde2|kde3)
+ EXE="$(which kdm)"
+ # kdm takes too long to create a pidfile for baselayout-2
+ #PIDFILE=/var/run/kdm.pid
+ PIDFILE=
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=
+ ;;
+ entrance*)
+ EXE=/usr/sbin/entranced
+ PIDFILE=/var/lib/entranced.pid
+ ;;
+ gdm|gnome)
+ EXE=/usr/bin/gdm
+ [ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+ PIDFILE=/var/run/gdm.pid
+ ;;
+ wdm)
+ EXE=/usr/bin/wdm
+ PIDFILE=
+ ;;
+ gpe)
+ EXE=/usr/bin/gpe-dm
+ PIDFILE=/var/run/gpe-dm.pid
+ ;;
+ *)
+ EXE=
+ # Fix #65586, where MY_XDM is empty so EXE=somedir
+ [ -x "/usr/bin/${MY_XDM}" ] && [ -f "/usr/bin/${MY_XDM}" ] \
+ && EXE="/usr/bin/${MY_XDM}"
+ if [ -z "${EXE}" ] ; then
+ EXE=/usr/bin/xdm
+ PIDFILE=/var/run/xdm.pid
+ fi
+ ;;
+ esac
+
+ if ! [ -x "${EXE}" ] ; then
+ EXE=/usr/bin/xdm
+ PIDFILE=/var/run/xdm.pid
+ if ! [ -x "/usr/bin/xdm" ] ; then
+ echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+ echo " or install x11-apps/xdm package"
+ eend 255
+ fi
+ fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+ if [ -e /etc/inittab ] ; then
+ grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+ elif [ -e /etc/ttys ] ; then
+ grep -q "^ttyv$(($1 - 1))" /etc/ttys
+ else
+ return 1
+ fi
+}
+
+start() {
+ local EXE= NAME= PIDFILE=
+ setup_dm
+
+ if [ -f /etc/init.d/.noxdm -o -f /tmp/.noxdm ] ; then
+ einfo "Skipping ${EXE}, /etc/init.d/.noxdm or /tmp/.noxdm found"
+ rm /etc/init.d/.noxdm /tmp/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+ #save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+
+ if [ -n "${CHECKVT-y}" ] ; then
+ if vtstatic "${CHECKVT:-7}" ; then
+ if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ] ; then
+ ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+ telinit a >/dev/null 2>/dev/null
+ return 0
+ else
+ eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+ return 1
+ fi
+ fi
+ fi
+
+ /etc/X11/startDM.sh
+ eend 0
+}
+
+stop() {
+ local retval=0
+ local curvt=
+ if [ -t 0 ] ; then
+ if type fgconsole >/dev/null 2>/dev/null ; then
+ curvt="$(fgconsole 2>/dev/null)"
+ else
+ curvt="$(tty)"
+ case "${curvt}" in
+ /dev/ttyv[0-9]*) curvt="${curvt#/dev/ttyv*}" ;;
+ *) curvt= ;;
+ esac
+ fi
+ fi
+ local myexe="$(get_options "service")"
+ local myname="$(get_options "name")"
+ local mypidfile="$(get_options "pidfile")"
+ local myservice=${myexe##*/}
+
+ [ -z "${myexe}" ] && return 0
+
+ ebegin "Stopping ${myservice}"
+
+ if start-stop-daemon --quiet --test --stop --exec "${myexe}" ; then
+ start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+ ${mypidfile:+--pidfile} ${mypidfile} \
+ ${myname:+--name} ${myname}
+ retval=$?
+ fi
+
+ # switch back to original vt
+ if [ -n "${curvt}" ] ; then
+ if type chvt >/dev/null 2>/dev/null ; then
+ chvt "${curvt}"
+ else
+ vidcontrol -s "$((${curvt} + 1))"
+ fi
+ fi
+ eend ${retval} "Error stopping ${myservice}"
+
+ return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-apps/xinit/files/xinit-1.0.4-console-kit.patch b/x11-apps/xinit/files/xinit-1.0.4-console-kit.patch
new file mode 100644
index 00000000..645e4e53
--- /dev/null
+++ b/x11-apps/xinit/files/xinit-1.0.4-console-kit.patch
@@ -0,0 +1,197 @@
+diff --git a/Makefile.am b/Makefile.am
+index babc2f3..9b912a3 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -24,8 +24,8 @@ XINITDIR = $(libdir)/X11/xinit
+ bin_PROGRAMS = xinit
+ bin_SCRIPTS = startx
+
+-xinit_CFLAGS = $(XINIT_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
+-xinit_LDADD = $(XINIT_LIBS)
++xinit_CFLAGS = $(XINIT_CFLAGS) $(CK_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
++xinit_LDADD = $(XINIT_LIBS) $(CK_LIBS)
+
+ xinit_SOURCES = \
+ xinit.c
+diff --git a/configure.ac b/configure.ac
+index 1aee1d2..5775db3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -47,6 +47,7 @@ DEFAULT_XMODMAP=xmodmap
+ DEFAULT_TWM=twm
+ DEFAULT_XCLOCK=xclock
+ DEFAULT_XTERM=xterm
++DEFAULT_CK=yes
+ # You always want to specify the full path to the X server
+ DEFAULT_XSERVER=${bindir}/X
+ DEFAULT_XAUTH=xauth
+@@ -104,6 +105,20 @@ esac
+ AC_SUBST(XINIT_CFLAGS)
+ AC_SUBST(XINIT_LIBS)
+
++# Check for ConsoleKit
++AC_ARG_WITH(consolekit,
++ AS_HELP_STRING([--with-consolekit], [Use ConsoleKit in xinit]),
++ [CK="$withval"],
++ [CK="$DEFAULT_CK"])
++if test "x$CK" != xno ; then
++ PKG_CHECK_MODULES(CK, ck-connector,
++ have_conkit=yes,
++ [have_conkit=no; echo no])
++ if test "x$have_conkit" = xyes ; then
++ AC_DEFINE(USE_CONKIT, 1, [Define if you have ConsoleKit])
++ fi
++fi
++
+ AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
+ [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
+ if test "x$MCOOKIE" != x ; then
+diff --git a/startx.cpp b/startx.cpp
+index 42421ef..998c7f8 100644
+--- a/startx.cpp
++++ b/startx.cpp
+@@ -222,6 +222,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}
+diff --git a/xinit.c b/xinit.c
+index 46dee54..c2c4527 100644
+--- a/xinit.c
++++ b/xinit.c
+@@ -39,6 +39,12 @@ in this Software without prior written authorization from The Open Group.
+ #include <ctype.h>
+ #include <stdint.h>
+
++#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 +527,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 +670,12 @@ startServer(char *server[])
+ break;
+ }
+
++#ifdef USE_CONKIT
++ if (serverpid != -1 ) {
++ register_new_session_with_console_kit ();
++ }
++#endif /* USE_CONKIT */
++
+ return(serverpid);
+ }
+
+@@ -775,6 +820,13 @@ shutdown(void)
+ clientpid);
+ }
+
++#ifdef USE_CONKIT
++ if (ckc != NULL) {
++ ck_connector_unref (ckc);
++ ckc = NULL;
++ }
++#endif
++
+ if (serverpid < 0)
+ return;
+ errno = 0;
+@@ -811,6 +863,13 @@ shutdown(void)
+ * make a new copy of environment that has room for DISPLAY
+ */
+
++
++#ifdef USE_CONKIT
++#define NUM_EXTRA_ENV_VARS 4
++#else
++#define NUM_EXTRA_ENV_VARS 3
++#endif
++
+ static void
+ set_environment(void)
+ {
+@@ -822,11 +881,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);
+ }
+
+@@ -836,10 +895,18 @@ 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 --git a/x11-apps/xinit/files/xinitrc b/x11-apps/xinit/files/xinitrc
new file mode 100644
index 00000000..6072d116
--- /dev/null
+++ b/x11-apps/xinit/files/xinitrc
@@ -0,0 +1,50 @@
+#!/bin/sh
+# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
+
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+xinitdir=/etc/X11
+sysresources=$xinitdir/Xresources
+sysmodmap=$xinitdir/Xmodmap
+
+# merge in defaults and keymaps
+
+if [ -f $sysresources ]; then
+ xrdb -merge $sysresources
+fi
+
+if [ -f $sysmodmap ]; then
+ xmodmap $sysmodmap
+fi
+
+if [ -f $userresources ]; then
+ xrdb -merge $userresources
+fi
+
+if [ -f $usermodmap ]; then
+ xmodmap $usermodmap
+fi
+
+# First try ~/.xinitrc
+if [ -f "$HOME/.xinitrc" ]; then
+ XINITRC="$HOME/.xinitrc"
+ if [ -x $XINITRC ]; then
+ # if the x bit is set on .xinitrc
+ # it means the xinitrc is not a
+ # shell script but something else
+ exec $XINITRC
+ else
+ exec /bin/sh "$HOME/.xinitrc"
+ fi
+# If not present, try the system default
+elif [ -n "`/etc/X11/chooser.sh`" ]; then
+ exec "`/etc/X11/chooser.sh`"
+# Failsafe
+else
+ # start some nice programs
+ twm &
+ xclock -geometry 50x50-1+1 &
+ xterm -geometry 80x50+494+51 &
+ xterm -geometry 80x20+494-0 &
+ exec xterm -geometry 80x66+0+0 -name login
+fi
diff --git a/x11-apps/xinit/files/xserver.pamd b/x11-apps/xinit/files/xserver.pamd
new file mode 100644
index 00000000..b093f86a
--- /dev/null
+++ b/x11-apps/xinit/files/xserver.pamd
@@ -0,0 +1,5 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+auth required pam_permit.so
+
+account required pam_permit.so
diff --git a/x11-apps/xinit/xinit-1.0.8-r8.ebuild b/x11-apps/xinit/xinit-1.0.8-r8.ebuild
new file mode 100644
index 00000000..4cdd1700
--- /dev/null
+++ b/x11-apps/xinit/xinit-1.0.8-r8.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/xinit-1.0.8-r8.ebuild,v 1.7 2009/09/29 17:34:22 klausman Exp $
+
+EAPI="2"
+
+# Must be before x-modular eclass is inherited
+# This is enabled due to modified Makefile.am from the patches
+SNAPSHOT="yes"
+
+inherit x-modular pam
+
+DESCRIPTION="X Window System initializer"
+
+LICENSE="${LICENSE} GPL-2"
+KEYWORDS="alpha amd64 ~arm hppa ~ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd"
+IUSE="consolekit minimal pam"
+
+RDEPEND="
+ x11-apps/xauth
+ x11-libs/libX11
+ consolekit? (
+ sys-auth/consolekit
+ sys-apps/dbus[X]
+ )
+"
+DEPEND="${RDEPEND}"
+PDEPEND="!minimal? (
+ x11-apps/xclock
+ x11-apps/xrdb
+ x11-apps/xsm
+ x11-terms/xterm
+ x11-wm/twm
+ )
+"
+
+PATCHES=( "${FILESDIR}"/nolisten-tcp-and-black-background.patch
+ "${FILESDIR}"/gentoo-startx-customization-1.0.8.patch
+ "${FILESDIR}"/xinit-1.0.4-console-kit.patch )
+
+pkg_setup() {
+ CONFIGURE_OPTIONS="$(use_with consolekit)"
+}
+
+src_prepare() {
+ x-modular_patch_source
+
+ sed -i -e "s:^XINITDIR.*:XINITDIR = \$(sysconfdir)/X11/xinit:g" "${S}/Makefile.am"
+
+ x-modular_reconf_source
+}
+
+src_install() {
+ x-modular_src_install
+ exeinto /etc/X11
+ doexe "${FILESDIR}"/chooser.sh "${FILESDIR}"/startDM.sh || die
+ exeinto /etc/X11/Sessions
+ doexe "${FILESDIR}"/Xsession || die
+ exeinto /etc/X11/xinit
+ doexe "${FILESDIR}"/xinitrc || die
+ newinitd "${FILESDIR}"/xdm.initd-3 xdm
+ newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+ newconfd "${FILESDIR}"/xdm.confd-1 xdm
+ newpamd "${FILESDIR}"/xserver.pamd xserver
+}
+
+pkg_postinst() {
+ x-modular_pkg_postinst
+ ewarn "If you use startx to start X instead of a login manager like gdm/kdm,"
+ ewarn "you can set the XSESSION variable to anything in /etc/X11/Sessions/ or"
+ ewarn "any executable. When you run startx, it will run this as the login session."
+ ewarn "You can set this in a file in /etc/env.d/ for the entire system,"
+ ewarn "or set it per-user in ~/.bash_profile (or similar for other shells)."
+ ewarn "Here's an example of setting it for the whole system:"
+ ewarn " echo XSESSION=\"Gnome\" > /etc/env.d/90xsession"
+ ewarn " env-update && source /etc/profile"
+}