summaryrefslogtreecommitdiff
path: root/x11-base/xorg-server/files
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:24:26 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:24:26 +0200
commit7224c1253228e5c29c78cb3f0f26ce34770f2356 (patch)
tree1684924656132935256e034f35f92abee6623265 /x11-base/xorg-server/files
Added ebuilds for kogaion desktop
Diffstat (limited to 'x11-base/xorg-server/files')
-rw-r--r--x11-base/xorg-server/files/xdm-setup.initd-114
-rw-r--r--x11-base/xorg-server/files/xdm.confd-316
-rw-r--r--x11-base/xorg-server/files/xdm.confd-410
-rwxr-xr-xx11-base/xorg-server/files/xdm.initd209
-rw-r--r--x11-base/xorg-server/files/xdm.initd-3218
-rw-r--r--x11-base/xorg-server/files/xdm.initd-4220
-rw-r--r--x11-base/xorg-server/files/xdm.initd-5219
-rw-r--r--x11-base/xorg-server/files/xdm.initd-7220
-rw-r--r--x11-base/xorg-server/files/xdm.initd-8216
-rw-r--r--x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch22
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch64
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch27
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch48
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch441
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch87
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch11
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch35
-rw-r--r--x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch30
-rw-r--r--x11-base/xorg-server/files/xorg-server-die-ugly-background.patch16
-rw-r--r--x11-base/xorg-server/files/xorg-server-disable-acpi.patch31
-rw-r--r--x11-base/xorg-server/files/xorg-server-glapi_c.patch78
-rw-r--r--x11-base/xorg-server/files/xorg-sets.conf6
22 files changed, 2238 insertions, 0 deletions
diff --git a/x11-base/xorg-server/files/xdm-setup.initd-1 b/x11-base/xorg-server/files/xdm-setup.initd-1
new file mode 100644
index 00000000..365664e6
--- /dev/null
+++ b/x11-base/xorg-server/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-base/xorg-server/files/xdm-setup.initd-1,v 1.1 2010/04/13 10:07:39 scarabeus Exp $
+
+depend() {
+ need localmount
+}
+
+start() {
+ if get_bootparam "nox" ; then
+ touch /etc/.noxdm
+ fi
+}
diff --git a/x11-base/xorg-server/files/xdm.confd-3 b/x11-base/xorg-server/files/xdm.confd-3
new file mode 100644
index 00000000..9c560bb1
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.confd-3
@@ -0,0 +1,16 @@
+# 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 haven't accidentally 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-4.3 | gpe | entrance ]
+# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
+#
+# KDE-specific note:
+# - If you are using kdeprefix go with "kdm-4.Y", e.g. "kdm-4.3".
+# You can find possible versions by looking at the directories in /usr/kde/.
+# - Else, if you are using KDE 3 enter "kdm-3.5"
+# - Else, if you are using KDE 4 enter "kdm" without a version
+DISPLAYMANAGER="xdm" \ No newline at end of file
diff --git a/x11-base/xorg-server/files/xdm.confd-4 b/x11-base/xorg-server/files/xdm.confd-4
new file mode 100644
index 00000000..de0a7cbf
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.confd-4
@@ -0,0 +1,10 @@
+# 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 haven't accidentally 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 | lxdm | gpe | entrance ]
+# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
+DISPLAYMANAGER="xdm"
diff --git a/x11-base/xorg-server/files/xdm.initd b/x11-base/xorg-server/files/xdm.initd
new file mode 100755
index 00000000..988becf6
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd
@@ -0,0 +1,209 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd,v 1.1 2010/04/13 10:07:39 scarabeus 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota
+ before alsasound
+
+ # Start before X
+ use consolekit xfs
+ @HALD_DEPEND@
+}
+
+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)
+ EXE="$(which kdm)"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(which ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ "${EXE}" = "" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ] ; then
+ einfo "Skipping ${EXE}, /etc/.noxdm found"
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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-base/xorg-server/files/xdm.initd-3 b/x11-base/xorg-server/files/xdm.initd-3
new file mode 100644
index 00000000..7e2da1a7
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-3
@@ -0,0 +1,218 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-3,v 1.3 2011/11/01 22:53:09 hwoarang 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota
+ before alsasound
+
+ # Start before X
+ use consolekit xfs
+}
+
+setup_dm() {
+ local MY_XDM
+
+ MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+ NAME=
+ case "${MY_XDM}" in
+ kdm|kde)
+ EXE="$(which kdm)"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ lightdm)
+ EXE=/usr/sbin/lightdm
+ PIDFILE=/var/run/lightdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(which ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ -z "${EXE}" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ]; then
+ einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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>&1
+ 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 curvt retval
+
+ retval=0
+ if [ -t 0 ]; then
+ if type fgconsole >/dev/null 2>&1; 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 myname mypidfile myservice
+ myexe=$(get_options "service")
+ myname=$(get_options "name")
+ mypidfile=$(get_options "pidfile")
+ 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>&1; 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-base/xorg-server/files/xdm.initd-4 b/x11-base/xorg-server/files/xdm.initd-4
new file mode 100644
index 00000000..d20265e2
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-4
@@ -0,0 +1,220 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-4,v 1.1 2011/11/16 21:49:59 chithanh 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ # (#390609) gdm-3 will fail when dbus is not running
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota
+ after dbus
+ before alsasound
+
+ # Start before X
+ use consolekit xfs
+}
+
+setup_dm() {
+ local MY_XDM
+
+ MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+ NAME=
+ case "${MY_XDM}" in
+ kdm|kde)
+ EXE="$(which kdm)"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ lightdm)
+ EXE=/usr/sbin/lightdm
+ PIDFILE=/var/run/lightdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(which ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ -z "${EXE}" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ]; then
+ einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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>&1
+ 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 curvt retval
+
+ retval=0
+ if [ -t 0 ]; then
+ if type fgconsole >/dev/null 2>&1; 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 myname mypidfile myservice
+ myexe=$(get_options "service")
+ myname=$(get_options "name")
+ mypidfile=$(get_options "pidfile")
+ 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>&1; 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-base/xorg-server/files/xdm.initd-5 b/x11-base/xorg-server/files/xdm.initd-5
new file mode 100644
index 00000000..c152e40e
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-5
@@ -0,0 +1,219 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-5,v 1.1 2011/11/24 13:09:40 chithanh 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ # (#390609) gdm-3 will fail when dbus is not running
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota
+ before alsasound
+
+ # Start before X
+ use consolekit dbus xfs
+}
+
+setup_dm() {
+ local MY_XDM
+
+ MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+ NAME=
+ case "${MY_XDM}" in
+ kdm|kde)
+ EXE="$(which kdm)"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ lightdm)
+ EXE=/usr/sbin/lightdm
+ PIDFILE=/var/run/lightdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(which ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ -z "${EXE}" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ]; then
+ einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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>&1
+ 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 curvt retval
+
+ retval=0
+ if [ -t 0 ]; then
+ if type fgconsole >/dev/null 2>&1; 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 myname mypidfile myservice
+ myexe=$(get_options "service")
+ myname=$(get_options "name")
+ mypidfile=$(get_options "pidfile")
+ 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>&1; 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-base/xorg-server/files/xdm.initd-7 b/x11-base/xorg-server/files/xdm.initd-7
new file mode 100644
index 00000000..51fc7004
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-7
@@ -0,0 +1,220 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-7,v 1.1 2012/03/20 16:02:51 ssuominen 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ # (#390609) gdm-3 will fail when dbus is not running
+ # (#366753) starting keymaps after X causes problems
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota keymaps
+ before alsasound
+
+ # Start before X
+ use consolekit dbus xfs
+}
+
+setup_dm() {
+ local MY_XDM
+
+ MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+ NAME=
+ case "${MY_XDM}" in
+ kdm|kde)
+ EXE="$(which kdm)"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ kdm-*)
+ EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ lightdm)
+ EXE=/usr/sbin/lightdm
+ PIDFILE=/var/run/lightdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(which ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ -z "${EXE}" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ]; then
+ einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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>&1
+ 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 curvt retval
+
+ retval=0
+ if [ -t 0 ]; then
+ if type fgconsole >/dev/null 2>&1; 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 myname mypidfile myservice
+ myexe=$(get_options "service")
+ myname=$(get_options "name")
+ mypidfile=$(get_options "pidfile")
+ 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>&1; 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-base/xorg-server/files/xdm.initd-8 b/x11-base/xorg-server/files/xdm.initd-8
new file mode 100644
index 00000000..539cac10
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-8
@@ -0,0 +1,216 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-8,v 1.1 2012/05/01 22:08:46 chithanh 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
+
+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
+ # (#291269) Start after quota, since some dm need readable home
+ # (#390609) gdm-3 will fail when dbus is not running
+ # (#366753) starting keymaps after X causes problems
+ after bootmisc consolefont modules netmount
+ after readahead-list ypbind autofs openvpn gpm lircmd
+ after quota keymaps
+ before alsasound
+
+ # Start before X
+ use consolekit dbus xfs
+}
+
+setup_dm() {
+ local MY_XDM
+
+ MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+ # Load our root path from profile.env
+ # Needed for kdm
+ PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+ NAME=
+ case "${MY_XDM}" in
+ kdm|kde)
+ EXE=/usr/bin/kdm
+ PIDFILE=/var/run/kdm.pid
+ ;;
+ 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
+ ;;
+ lxdm)
+ EXE=/usr/sbin/lxdm-binary
+ PIDFILE=/var/run/lxdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ lightdm)
+ EXE=/usr/sbin/lightdm
+ PIDFILE=/var/run/lightdm.pid
+ START_STOP_ARGS="--background"
+ ;;
+ *)
+ # first find out if there is such executable
+ EXE="$(command -v ${MY_XDM} 2>/dev/null)"
+ PIDFILE="/var/run/${MY_XDM}.pid"
+
+ # warn user that he is doing sick things if the exe was not found
+ if [ -z "${EXE}" ]; then
+ echo "ERROR: Your XDM value is invalid."
+ echo " No ${MY_XDM} executable could be found on your system."
+ 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/.noxdm ]; then
+ einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+ rm /etc/.noxdm
+ return 0
+ fi
+
+ ebegin "Setting up ${EXE##*/}"
+
+ # save the prefered DM
+ save_options "service" "${EXE}"
+ save_options "name" "${NAME}"
+ save_options "pidfile" "${PIDFILE}"
+ save_options "start_stop_args" "${START_STOP_ARGS}"
+
+ 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>&1
+ 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 curvt retval
+
+ retval=0
+ if [ -t 0 ]; then
+ if type fgconsole >/dev/null 2>&1; 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 myname mypidfile myservice
+ myexe=$(get_options "service")
+ myname=$(get_options "name")
+ mypidfile=$(get_options "pidfile")
+ 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>&1; 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-base/xorg-server/files/xorg-cve-2011-4028+4029.patch b/x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch
new file mode 100644
index 00000000..66e77f66
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch
@@ -0,0 +1,22 @@
+diff --git a/os/utils.c b/os/utils.c
+index e8ecb71..18ff1ca 100644
+--- a/os/utils.c
++++ b/os/utils.c
+@@ -297,7 +297,7 @@ LockServer(void)
+ FatalError("Could not create lock file in %s\n", tmp);
+ (void) sprintf(pid_str, "%10ld\n", (long)getpid());
+ (void) write(lfd, pid_str, 11);
+- (void) chmod(tmp, 0444);
++ (void) fchmod(lfd, 0444);
+ (void) close(lfd);
+
+ /*
+@@ -318,7 +318,7 @@ LockServer(void)
+ /*
+ * Read the pid from the existing file
+ */
+- lfd = open(LockFile, O_RDONLY);
++ lfd = open(LockFile, O_RDONLY|O_NOFOLLOW);
+ if (lfd < 0) {
+ unlink(tmp);
+ FatalError("Can't read lock file %s\n", LockFile);
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch b/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch
new file mode 100644
index 00000000..facb9727
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch
@@ -0,0 +1,64 @@
+diff -ur a/test/Makefile.am b/test/Makefile.am
+--- a/test/Makefile.am 2011-07-15 15:26:40.000000000 +0200
++++ b/test/Makefile.am 2012-01-02 01:03:15.232740535 +0100
+@@ -1,21 +1,32 @@
+ if ENABLE_UNIT_TESTS
+ if HAVE_LD_WRAP
+-SUBDIRS= . xi2
+-noinst_PROGRAMS = xkb input xtest list misc fixes
++SUBDIRS= .
++noinst_PROGRAMS = list
++if XORG
++# Tests that require at least some DDX functions in order to fully link
++# For now, requires xf86 ddx, could be adjusted to use another
++SUBDIRS += xi2
++noinst_PROGRAMS += xkb input xtest misc fixes
++endif
+ check_LTLIBRARIES = libxservertest.la
+
+ TESTS=$(noinst_PROGRAMS)
+
+ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser \
+- -I$(top_srcdir)/miext/cw -I$(top_srcdir)/hw/xfree86/ddc \
++INCLUDES = $(XORG_INCS) -I$(top_srcdir)/miext/cw
++if XORG
++INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
++ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
+ -I$(top_srcdir)/hw/xfree86/ramdac
++endif
+ TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
++if XORG
+ if SPECIAL_DTRACE_OBJECTS
+ TEST_LDADD += $(OS_LIB) $(DIX_LIB)
+ endif
++endif
+
+ xkb_LDADD=$(TEST_LDADD)
+ input_LDADD=$(TEST_LDADD)
+@@ -24,9 +35,10 @@
+ misc_LDADD=$(TEST_LDADD)
+ fixes_LDADD=$(TEST_LDADD)
+
++libxservertest_la_LIBADD = $(XSERVER_LIBS)
++if XORG
+ nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
+-libxservertest_la_LIBADD = \
+- $(XSERVER_LIBS) \
++libxservertest_la_LIBADD += \
+ $(top_builddir)/hw/xfree86/loader/libloader.la \
+ $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
+ $(top_builddir)/hw/xfree86/common/libcommon.la \
+@@ -36,7 +48,9 @@
+ $(top_builddir)/hw/xfree86/ramdac/libramdac.la \
+ $(top_builddir)/hw/xfree86/ddc/libddc.la \
+ $(top_builddir)/hw/xfree86/i2c/libi2c.la \
+- $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
++ $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la
++endif
++libxservertest_la_LIBADD += \
+ $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/os/libos.la \
+ @XORG_LIBS@
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch b/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch
new file mode 100644
index 00000000..d548c898
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch
@@ -0,0 +1,27 @@
+From 3ce102c362cadcd7087bdcf48440d9498eaf77d0 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 05 Jan 2012 12:08:01 +0000
+Subject: dix: on PointerRootWin send a FocusIn to the sprite window too
+
+XTS XSetDeviceFocus-7
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+diff --git a/dix/enterleave.c b/dix/enterleave.c
+index 2b8c7c5..89a82ab 100644
+--- a/dix/enterleave.c
++++ b/dix/enterleave.c
+@@ -1299,7 +1299,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
+ for (i = 0; i < nscreens; i++)
+ DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
+ if (to == PointerRootWin)
++ {
+ DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer);
++ DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
++ }
+ }
+ else
+ {
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch b/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch
new file mode 100644
index 00000000..e9ba0a7c
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch
@@ -0,0 +1,48 @@
+From a125aabda3a5cf27aa98cb61f16e49280b66f451 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 05 Jan 2012 12:02:51 +0000
+Subject: dix: send focus events to the immediate parent (#44079)
+
+For a transition from windows A to B, A->parent did not receive an event.
+DeviceFocusOutEvents sends to windows ]from, to[, so start with the actual
+window, not it's parent.
+
+X.Org Bug 44079 <http://bugs.freedesktop.org/show_bug.cgi?id=44079>
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+Reviewed-by: Keith Packard <keithp@keithp.com>
+---
+diff --git a/dix/enterleave.c b/dix/enterleave.c
+index a39e640..2b8c7c5 100644
+--- a/dix/enterleave.c
++++ b/dix/enterleave.c
+@@ -1292,7 +1292,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+ NotifyPointer);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
+ /* next call catches the root too, if the screen changed */
+- DeviceFocusOutEvents(dev, from->parent, NullWindow, mode,
++ DeviceFocusOutEvents(dev, from, NullWindow, mode,
+ NotifyNonlinearVirtual);
+ }
+ /* Notify all the roots */
+@@ -1321,7 +1321,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+ if (IsParent(to, from))
+ {
+ DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
+- DeviceFocusOutEvents(dev, from->parent, to, mode,
++ DeviceFocusOutEvents(dev, from, to, mode,
+ NotifyVirtual);
+ DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
+ if ((IsParent(to, sprite->win)) &&
+@@ -1353,7 +1353,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+ NotifyPointer);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
+ if (from->parent != NullWindow)
+- DeviceFocusOutEvents(dev, from->parent, common, mode,
++ DeviceFocusOutEvents(dev, from, common, mode,
+ NotifyNonlinearVirtual);
+ if (to->parent != NullWindow)
+ DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch b/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch
new file mode 100644
index 00000000..61e7eae6
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch
@@ -0,0 +1,441 @@
+Description: extreme backport of upstream log format fixes (CVE-2012-2118).
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/996250
+Origin: http://patchwork.freedesktop.org/patch/10001/
+
+Index: xorg-server-1.11.4/os/log.c
+===================================================================
+--- xorg-server-1.11.4.orig/os/log.c 2012-05-06 11:03:17.621808123 -0700
++++ xorg-server-1.11.4/os/log.c 2012-05-06 11:03:18.057814189 -0700
+@@ -167,6 +167,12 @@
+ #ifndef X_NOT_IMPLEMENTED_STRING
+ #define X_NOT_IMPLEMENTED_STRING "(NI)"
+ #endif
++#ifndef X_DEBUG_STRING
++#define X_DEBUG_STRING "(DB)"
++#endif
++#ifndef X_NONE_STRING
++#define X_NONE_STRING ""
++#endif
+
+ /*
+ * LogInit is called to start logging to a file. It is also called (with
+@@ -223,7 +229,7 @@
+ * needed.
+ */
+ if (saveBuffer && bufferSize > 0) {
+- free(saveBuffer); /* Must be free(), not free() */
++ free(saveBuffer);
+ saveBuffer = NULL;
+ bufferSize = 0;
+ }
+@@ -265,36 +271,19 @@
+ }
+
+ /* This function does the actual log message writes. */
+-
+-void
+-LogVWrite(int verb, const char *f, va_list args)
++static void
++LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
+ {
+- static char tmpBuffer[1024];
+- int len = 0;
+ static Bool newline = TRUE;
+
+- if (newline) {
+- sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
+- len = strlen(tmpBuffer);
+- if (logFile)
+- fwrite(tmpBuffer, len, 1, logFile);
+- }
+-
+- /*
+- * Since a va_list can only be processed once, write the string to a
+- * buffer, and then write the buffer out to the appropriate output
+- * stream(s).
+- */
+- if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
+- vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
+- len = strlen(tmpBuffer);
+- }
+- newline = (tmpBuffer[len-1] == '\n');
+- if ((verb < 0 || logVerbosity >= verb) && len > 0)
+- fwrite(tmpBuffer, len, 1, stderr);
+- if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
++ if (verb < 0 || logVerbosity >= verb)
++ fwrite(buf, len, 1, stderr);
++ if (verb < 0 || logFileVerbosity >= verb) {
+ if (logFile) {
+- fwrite(tmpBuffer, len, 1, logFile);
++ if (newline)
++ fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0);
++ newline = end_line;
++ fwrite(buf, len, 1, logFile);
+ if (logFlush) {
+ fflush(logFile);
+ #ifndef WIN32
+@@ -311,13 +300,19 @@
+ FatalError("realloc() failed while saving log messages\n");
+ }
+ bufferUnused -= len;
+- memcpy(saveBuffer + bufferPos, tmpBuffer, len);
++ memcpy(saveBuffer + bufferPos, buf, len);
+ bufferPos += len;
+ }
+ }
+ }
+
+ void
++LogVWrite(int verb, const char *f, va_list args)
++{
++ return LogVMessageVerb(X_NONE, verb, f, args);
++}
++
++void
+ LogWrite(int verb, const char *f, ...)
+ {
+ va_list args;
+@@ -327,60 +322,75 @@
+ va_end(args);
+ }
+
+-void
+-LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
++/* Returns the Message Type string to prepend to a logging message, or NULL
++ * if the message will be dropped due to insufficient verbosity. */
++static const char *
++LogMessageTypeVerbString(MessageType type, int verb)
+ {
+- const char *s = X_UNKNOWN_STRING;
+- char tmpBuf[1024];
++ if (type == X_ERROR)
++ verb = 0;
+
+- /* Ignore verbosity for X_ERROR */
+- if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) {
+- switch (type) {
+- case X_PROBED:
+- s = X_PROBE_STRING;
+- break;
+- case X_CONFIG:
+- s = X_CONFIG_STRING;
+- break;
+- case X_DEFAULT:
+- s = X_DEFAULT_STRING;
+- break;
+- case X_CMDLINE:
+- s = X_CMDLINE_STRING;
+- break;
+- case X_NOTICE:
+- s = X_NOTICE_STRING;
+- break;
+- case X_ERROR:
+- s = X_ERROR_STRING;
+- if (verb > 0)
+- verb = 0;
+- break;
+- case X_WARNING:
+- s = X_WARNING_STRING;
+- break;
+- case X_INFO:
+- s = X_INFO_STRING;
+- break;
+- case X_NOT_IMPLEMENTED:
+- s = X_NOT_IMPLEMENTED_STRING;
+- break;
+- case X_UNKNOWN:
+- s = X_UNKNOWN_STRING;
+- break;
+- case X_NONE:
+- s = NULL;
+- break;
+- }
++ if (logVerbosity < verb && logFileVerbosity < verb)
++ return NULL;
+
+- /* if s is not NULL we need a space before format */
+- snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "",
+- s ? " " : "",
+- format);
+- LogVWrite(verb, tmpBuf, args);
++ switch (type) {
++ case X_PROBED:
++ return X_PROBE_STRING;
++ case X_CONFIG:
++ return X_CONFIG_STRING;
++ case X_DEFAULT:
++ return X_DEFAULT_STRING;
++ case X_CMDLINE:
++ return X_CMDLINE_STRING;
++ case X_NOTICE:
++ return X_NOTICE_STRING;
++ case X_ERROR:
++ return X_ERROR_STRING;
++ case X_WARNING:
++ return X_WARNING_STRING;
++ case X_INFO:
++ return X_INFO_STRING;
++ case X_NOT_IMPLEMENTED:
++ return X_NOT_IMPLEMENTED_STRING;
++ case X_UNKNOWN:
++ return X_UNKNOWN_STRING;
++ case X_NONE:
++ return X_NONE_STRING;
++ case X_DEBUG:
++ return X_DEBUG_STRING;
++ default:
++ return X_UNKNOWN_STRING;
+ }
+ }
+
++void
++LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
++{
++ const char *type_str;
++ char buf[1024];
++ const size_t size = sizeof(buf);
++ Bool newline;
++ size_t len = 0;
++
++ type_str = LogMessageTypeVerbString(type, verb);
++ if (!type_str)
++ return;
++
++ /* if type_str is not "", prepend it and ' ', to message */
++ if (type_str[0] != '\0')
++ len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
++
++ if (size - len > 1)
++ len += Xvscnprintf(&buf[len], size - len, format, args);
++
++ /* Force '\n' at end of truncated line */
++ if (size - len == 1)
++ buf[len - 1] = '\n';
++
++ newline = (buf[len - 1] == '\n');
++ LogSWrite(verb, buf, len, newline);
++}
++
+ /* Log message with verbosity level specified. */
+ void
+ LogMessageVerb(MessageType type, int verb, const char *format, ...)
+@@ -404,6 +414,49 @@
+ }
+
+ void
++LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
++ va_list msg_args, const char *hdr_format, va_list hdr_args)
++{
++ const char *type_str;
++ char buf[1024];
++ const size_t size = sizeof(buf);
++ Bool newline;
++ size_t len = 0;
++
++ type_str = LogMessageTypeVerbString(type, verb);
++ if (!type_str)
++ return;
++
++ /* if type_str is not "", prepend it and ' ', to message */
++ if (type_str[0] != '\0')
++ len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
++
++ if (hdr_format && size - len > 1)
++ len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args);
++
++ if (msg_format && size - len > 1)
++ len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args);
++
++ /* Force '\n' at end of truncated line */
++ if (size - len == 1)
++ buf[len - 1] = '\n';
++
++ newline = (buf[len - 1] == '\n');
++ LogSWrite(verb, buf, len, newline);
++}
++
++void
++LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
++ va_list msg_args, const char *hdr_format, ...)
++{
++ va_list hdr_args;
++
++ va_start(hdr_args, hdr_format);
++ LogVHdrMessageVerb(type, verb, msg_format, msg_args, hdr_format, hdr_args);
++ va_end(hdr_args);
++}
++
++void
+ AbortServer(void) _X_NORETURN;
+ void
+ SigAbortServer(int signo) _X_NORETURN;
+Index: xorg-server-1.11.4/include/Xprintf.h
+===================================================================
+--- xorg-server-1.11.4.orig/include/Xprintf.h 2012-05-06 10:32:42.436348011 -0700
++++ xorg-server-1.11.4/include/Xprintf.h 2012-05-06 11:03:18.057814189 -0700
+@@ -66,4 +66,16 @@
+ # define vasprintf Xvasprintf
+ #endif
+
++/*
++ * These functions provide a portable implementation of the linux kernel
++ * scnprintf & vscnprintf routines that return the number of bytes actually
++ * copied during a snprintf, (excluding the final '\0').
++ */
++extern _X_EXPORT int
++Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...)
++_X_ATTRIBUTE_PRINTF(3,4);
++extern _X_EXPORT int
++Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va)
++_X_ATTRIBUTE_PRINTF(3,0);
++
+ #endif /* XPRINTF_H */
+Index: xorg-server-1.11.4/os/xprintf.c
+===================================================================
+--- xorg-server-1.11.4.orig/os/xprintf.c 2012-05-06 10:32:42.472348510 -0700
++++ xorg-server-1.11.4/os/xprintf.c 2012-05-06 11:03:18.057814189 -0700
+@@ -182,6 +182,50 @@
+ return size;
+ }
+
++/**
++ * Varargs snprintf that returns the actual number of bytes (excluding final
++ * '\0') that were copied into the buffer.
++ * This is opposed to the normal sprintf() usually returns the number of bytes
++ * that would have been written.
++ *
++ * @param s buffer to copy into
++ * @param n size of buffer s
++ * @param format printf style format string
++ * @param va variable argument list
++ * @return number of bytes actually copied, excluding final '\0'
++ */
++int
++Xvscnprintf(char *s, int n, const char *format, va_list args)
++{
++ int x;
++ if (n == 0)
++ return 0;
++ x = vsnprintf(s, n , format, args);
++ return (x >= n) ? (n - 1) : x;
++}
++
++/**
++ * snprintf that returns the actual number of bytes (excluding final '\0') that
++ * were copied into the buffer.
++ * This is opposed to the normal sprintf() usually returns the number of bytes
++ * that would have been written.
++ *
++ * @param s buffer to copy into
++ * @param n size of buffer s
++ * @param format printf style format string
++ * @param ... arguments for specified format
++ * @return number of bytes actually copied, excluding final '\0'
++ */
++int Xscnprintf(char *s, int n, const char *format, ...)
++{
++ int x;
++ va_list ap;
++ va_start(ap, format);
++ x = Xvscnprintf(s, n, format, ap);
++ va_end(ap);
++ return x;
++}
++
+ /* Old api, now deprecated, may be removed in the future */
+ char *
+ Xvprintf(const char *format, va_list va)
+Index: xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c
+===================================================================
+--- xorg-server-1.11.4.orig/hw/xfree86/common/xf86Helper.c 2012-05-06 10:32:42.488348731 -0700
++++ xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c 2012-05-06 11:03:18.057814189 -0700
+@@ -1036,25 +1036,13 @@
+ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ va_list args)
+ {
+- char *tmpFormat;
+-
+ /* Prefix the scrnIndex name to the format string. */
+ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
+- xf86Screens[scrnIndex]->name) {
+- tmpFormat = malloc(strlen(format) +
+- strlen(xf86Screens[scrnIndex]->name) +
+- PREFIX_SIZE + 1);
+- if (!tmpFormat)
+- return;
+-
+- snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
+- xf86Screens[scrnIndex]->name, scrnIndex);
+-
+- strcat(tmpFormat, format);
+- LogVMessageVerb(type, verb, tmpFormat, args);
+- free(tmpFormat);
+- } else
+- LogVMessageVerb(type, verb, format, args);
++ xf86Screens[scrnIndex]->name)
++ LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
++ xf86Screens[scrnIndex]->name, scrnIndex);
++ else
++ LogVMessageVerb(type, verb, format, args);
+ }
+ #undef PREFIX_SIZE
+
+@@ -1087,15 +1075,18 @@
+ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ va_list args)
+ {
+- char *msg;
++ const char *driverName = NULL;
++ const char *deviceName = NULL;
+
+- if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
+- == -1) {
+- LogVMessageVerb(type, verb, "%s", args);
+- } else {
+- LogVMessageVerb(type, verb, msg, args);
+- free(msg);
++ /* Prefix driver and device names to formatted message. */
++ if (dev) {
++ deviceName = dev->name;
++ if (dev->drv)
++ driverName = dev->drv->driverName;
+ }
++
++ LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
++ deviceName);
+ }
+
+ /* Print input driver message, with verbose level specified directly */
+Index: xorg-server-1.11.4/include/os.h
+===================================================================
+--- xorg-server-1.11.4.orig/include/os.h 2012-05-06 11:03:17.621808123 -0700
++++ xorg-server-1.11.4/include/os.h 2012-05-06 11:03:29.353971366 -0700
+@@ -514,6 +514,7 @@
+ X_INFO, /* Informational message */
+ X_NONE, /* No prefix */
+ X_NOT_IMPLEMENTED, /* Not implemented */
++ X_DEBUG, /* Debug message */
+ X_UNKNOWN = -1 /* unknown -- this must always be last */
+ } MessageType;
+
+@@ -528,6 +529,20 @@
+ ...) _X_ATTRIBUTE_PRINTF(3,4);
+ extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
+ _X_ATTRIBUTE_PRINTF(2,3);
++
++extern _X_EXPORT void
++LogVHdrMessageVerb(MessageType type, int verb,
++ const char *msg_format, va_list msg_args,
++ const char *hdr_format, va_list hdr_args)
++_X_ATTRIBUTE_PRINTF(3, 0)
++_X_ATTRIBUTE_PRINTF(5, 0);
++extern _X_EXPORT void
++LogHdrMessageVerb(MessageType type, int verb,
++ const char *msg_format, va_list msg_args,
++ const char *hdr_format, ...)
++_X_ATTRIBUTE_PRINTF(3, 0)
++_X_ATTRIBUTE_PRINTF(5, 6);
++
+ extern _X_EXPORT void FreeAuditTimer(void);
+ extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+ extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch b/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch
new file mode 100644
index 00000000..beb94a9d
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch
@@ -0,0 +1,87 @@
+From b2a4c09507b267495ea5e4c2e05373b323c80edf Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Sat, 17 Dec 2011 20:56:59 +0000
+Subject: kdrive/linux: Fix compilation with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
+
+Reported-by: Arkadiusz Miƛkiewicz <arekm@maven.pl>
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+Reviewed-by: Jamey Sharp <jamey@minilop.net>
+(cherry picked from commit 1deede3c48d5ac91f50774c79f02afc6e036614e)
+---
+diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
+index f5f9d9b..ba2637b 100644
+--- a/hw/kdrive/linux/keyboard.c
++++ b/hw/kdrive/linux/keyboard.c
+@@ -692,7 +692,7 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
+ return !Success;
+
+ fd = LinuxConsoleFd;
+- ki->driverPrivate = (void *) fd;
++ ki->driverPrivate = (void *) (intptr_t) fd;
+
+ ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
+ tcgetattr (fd, &LinuxTermios);
+@@ -724,7 +724,7 @@ LinuxKeyboardDisable (KdKeyboardInfo *ki)
+ if (!ki)
+ return;
+
+- fd = (int) ki->driverPrivate;
++ fd = (int) (intptr_t) ki->driverPrivate;
+
+ KdUnregisterFd(ki, fd, FALSE);
+ ioctl(fd, KDSKBMODE, LinuxKbdTrans);
+@@ -753,7 +753,7 @@ LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
+ if (!ki)
+ return;
+
+- ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
++ ioctl ((int)(intptr_t)ki->driverPrivate, KDSETLED, leds & 7);
+ }
+
+ KdKeyboardDriver LinuxKeyboardDriver = {
+diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
+index b6151cd..176e125 100644
+--- a/hw/kdrive/linux/ms.c
++++ b/hw/kdrive/linux/ms.c
+@@ -152,7 +152,7 @@ MsEnable (KdPointerInfo *pi)
+ }
+ if (KdRegisterFd (port, MsRead, pi))
+ return TRUE;
+- pi->driverPrivate = (void *)port;
++ pi->driverPrivate = (void *)(intptr_t)port;
+
+ return Success;
+
+@@ -164,7 +164,7 @@ MsEnable (KdPointerInfo *pi)
+ static void
+ MsDisable (KdPointerInfo *pi)
+ {
+- KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
++ KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ }
+
+ static void
+diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
+index 465b963..b62d769 100644
+--- a/hw/kdrive/linux/ps2.c
++++ b/hw/kdrive/linux/ps2.c
+@@ -159,7 +159,7 @@ Ps2Enable (KdPointerInfo *pi)
+ return BadAlloc;
+ }
+
+- pi->driverPrivate = (void *)fd;
++ pi->driverPrivate = (void *)(intptr_t)fd;
+
+ return Success;
+ }
+@@ -168,7 +168,7 @@ Ps2Enable (KdPointerInfo *pi)
+ static void
+ Ps2Disable (KdPointerInfo *pi)
+ {
+- KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
++ KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ }
+
+ static void
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch b/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch
new file mode 100644
index 00000000..df43dbde
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch
@@ -0,0 +1,11 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac 2011-10-31 19:40:02.000000000 +0100
++++ b/configure.ac 2011-10-31 19:41:02.372745481 +0100
+@@ -1624,7 +1624,6 @@
+ linux_alpha=yes
+ ;;
+ i*86|amd64*|x86_64*|ia64*)
+- linux_acpi="yes"
+ ;;
+ *)
+ ;;
diff --git a/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch b/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch
new file mode 100644
index 00000000..8fedc32c
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch
@@ -0,0 +1,35 @@
+Patch by Torsten Kaiser <x11@ariolc.dyndns.org>
+taken from https://bugs.freedesktop.org/show_bug.cgi?id=45623
+
+diff -ur a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
+--- a/hw/xfree86/modes/xf86EdidModes.c 2012-05-17 19:09:03.000000000 +0200
++++ b/hw/xfree86/modes/xf86EdidModes.c 2012-05-30 01:27:06.000000000 +0200
+@@ -723,7 +723,13 @@
+ 1920, 1200, 75, 0}, {
+ 1920, 1200, 85, 0}, {
+ 1920, 1440, 60, 0}, {
+-1920, 1440, 75, 0},};
++1920, 1440, 75, 0},
++ /* fill up last byte */
++ { 0,0,0,0 },
++ { 0,0,0,0 },
++ { 0,0,0,0 },
++ { 0,0,0,0 },
++};
+
+ static DisplayModePtr
+ DDCModesFromEstIII(unsigned char *est)
+@@ -732,10 +738,11 @@
+ int i, j, m;
+
+ for (i = 0; i < 6; i++) {
+- for (j = 7; j > 0; j--) {
++ for (j = 7; j >= 0; j--) {
+ if (est[i] & (1 << j)) {
+ m = (i * 8) + (7 - j);
+- modes = xf86ModesAdd(modes,
++ if (EstIIIModes[m].w)
++ modes = xf86ModesAdd(modes,
+ FindDMTMode(EstIIIModes[m].w,
+ EstIIIModes[m].h,
+ EstIIIModes[m].r,
diff --git a/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch b/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch
new file mode 100644
index 00000000..2b05967a
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch
@@ -0,0 +1,30 @@
+diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
+index 74016af..9c296f5 100644
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -1118,7 +1118,23 @@ videoPtrToDriverList(struct pci_device *dev,
+ break;
+ case 0x102b: driverList[0] = "mga"; break;
+ case 0x10c8: driverList[0] = "neomagic"; break;
+- case 0x10de: case 0x12d2: driverList[0] = "nv"; break;
++ case 0x10de: case 0x12d2:
++ switch (dev->device_id) {
++ /* NV1 */
++ case 0x0008:
++ case 0x0009:
++ driverList[0] = "vesa";
++ break;
++ /* NV3 */
++ case 0x0018:
++ case 0x0019:
++ driverList[0] = "nv";
++ break;
++ default:
++ driverList[0] = "nouveau";
++ break;
++ }
++ break;
+ case 0x1106: driverList[0] = "openchrome"; break;
+ case 0x1b36: driverList[0] = "qxl"; break;
+ case 0x1163: driverList[0] = "rendition"; break;
+--
diff --git a/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch b/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch
new file mode 100644
index 00000000..db1e2dc4
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch
@@ -0,0 +1,16 @@
+Remove the default root window grey stipple pattern, replacing it with
+blackness.
+
+--- dix/window.c.orig
++++ dix/window.c
+@@ -119,8 +119,8 @@
+ *
+ ******/
+
+-static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
+-static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
++static unsigned char _back_lsb[4] = {0x00, 0x00, 0x00, 0x00};
++static unsigned char _back_msb[4] = {0x00, 0x00, 0x00, 0x00};
+
+ int screenIsSaved = SCREEN_SAVER_OFF;
+
diff --git a/x11-base/xorg-server/files/xorg-server-disable-acpi.patch b/x11-base/xorg-server/files/xorg-server-disable-acpi.patch
new file mode 100644
index 00000000..cc80e6ce
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-disable-acpi.patch
@@ -0,0 +1,31 @@
+From a8079882f1884edc62a9de28af915bd8b65dfbbe Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 11 Mar 2009 14:02:11 -0400
+Subject: [PATCH] Don't build the ACPI code.
+
+No good can come of this.
+---
+ configure.ac | 2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 72ae67e..04716f8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1269,13 +1269,11 @@ if test "x$XORG" = xyes; then
+ case $host_cpu in
+ ia64*)
+ linux_ia64=yes
+- linux_acpi="yes"
+ ;;
+ alpha*)
+ linux_alpha=yes
+ ;;
+ i*86|amd64*|x86_64*)
+- linux_acpi="yes"
+ ;;
+ *)
+ ;;
+--
+1.6.1.3
+
diff --git a/x11-base/xorg-server/files/xorg-server-glapi_c.patch b/x11-base/xorg-server/files/xorg-server-glapi_c.patch
new file mode 100644
index 00000000..e65a969a
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-glapi_c.patch
@@ -0,0 +1,78 @@
+From 17d9e374721d6c8ee3f7f9cdc882f80127bdb57f Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 02 Mar 2011 18:21:39 +0000
+Subject: glx: Lobotomize _glapi_get_proc_address
+
+This isn't a meaningful thing in the indirect glx loader, so just warn
+if it ever happens and move on.
+
+But also, mark it PUBLIC, so if the driver does ever call it we merely
+warn instead of aborting because ld.so can't find the symbol.
+
+Reviewed-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/glx/glapi.c b/glx/glapi.c
+index 1814493..79ff6b1 100644
+--- a/glx/glapi.c
++++ b/glx/glapi.c
+@@ -54,6 +54,7 @@
+
+ #include <dix-config.h>
+ #include <X11/Xfuncproto.h>
++#include <os.h>
+ #define PUBLIC _X_EXPORT
+
+ #else
+@@ -713,43 +714,15 @@ _glapi_add_dispatch( const char * const * function_names,
+ return offset;
+ }
+
+-/**
+- * Return pointer to the named function. If the function name isn't found
+- * in the name of static functions, try generating a new API entrypoint on
+- * the fly with assembly language.
++/*
++ * glXGetProcAddress doesn't exist in the protocol, the drivers never call
++ * this themselves, and neither does the server. warn if it happens though.
+ */
+-_glapi_proc
++PUBLIC _glapi_proc
+ _glapi_get_proc_address(const char *funcName)
+ {
+- struct _glapi_function * entry;
+- GLuint i;
+-
+-#ifdef MANGLE
+- if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
+- return NULL;
+-#else
+- if (funcName[0] != 'g' || funcName[1] != 'l')
+- return NULL;
+-#endif
+-
+- /* search extension functions first */
+- for (i = 0; i < NumExtEntryPoints; i++) {
+- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+- return ExtEntryTable[i].dispatch_stub;
+- }
+- }
+-
+-#if !defined( XFree86Server ) && !defined( XGLServer )
+- /* search static functions */
+- {
+- const _glapi_proc func = get_static_proc_address(funcName);
+- if (func)
+- return func;
+- }
+-#endif /* !defined( XFree86Server ) */
+-
+- entry = add_function_name(funcName);
+- return (entry == NULL) ? NULL : entry->dispatch_stub;
++ ErrorF("_glapi_get_proc_address called!\n");
++ return NULL;
+ }
+
+ /**
+--
+cgit v0.8.3-6-g21f6
diff --git a/x11-base/xorg-server/files/xorg-sets.conf b/x11-base/xorg-server/files/xorg-sets.conf
new file mode 100644
index 00000000..5cd8112f
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-sets.conf
@@ -0,0 +1,6 @@
+# Rebuild all X11 modules (mostly useful after xorg-server ABI change).
+[x11-module-rebuild]
+class = portage.sets.dbapi.VariableSet
+world-candidate = false
+variable = CATEGORY
+includes = x11-drivers