[x11-apps/xhost] port ebuild from Portage, add our xhost patch

This commit is contained in:
Fabio Erculiani
2009-09-19 13:13:19 +02:00
parent aaf4bec873
commit 49e2f9aa2f
20 changed files with 1693 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
AUX 00-xhost 134 RMD160 b38bdf52c524e4322a42281b604b70f0364b1741 SHA1 9534d2ddfffd4379023694587e8d9d97f99dfb69 SHA256 9ca152c3d8e36dce650e890fb4e2acbd9c1019794ef6dc20b69a429928bd7097
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.4.patch 3863 RMD160 65d35c3aaf72861dbf393bb23aaac97763725891 SHA1 ab0acf592dfbdfe961489f3a417be350aefac1dd SHA256 eb0a88592a22203c9e7cb4ea3051f2b96adb244585ae4b990b384b6d8a35559c
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 346 RMD160 7d769710e1089b428457a775f73a0979de595da0 SHA1 cba117701f6e414c0aee6d936afdf9f609bfdd19 SHA256 99a569b9e342f3a9d6319e6e32bd765dc03e116c92d8eb4217ff6b6eeab2ea1c
AUX xdm.confd-1 722 RMD160 3a4f800a37935e711112ede9c847837104e4100f SHA1 d3b2551ec7be8e5cfa42cc14e1d47ab37ac9f116 SHA256 1f6a2bb28e499698bbdba825d6dcbc81622579b1cf5c9e33538b252d254935c3
AUX xdm.initd-1 5207 RMD160 c95d2df2feff76770ece8f0ec86e9bb53d76a257 SHA1 faefdeeca446fff29da2f4e546a3b0bcc94e6372 SHA256 891c7b060c6b47c135b32ffd918a0b6add5e9c7c03893ee0c1d56b64bd7987ea
AUX xdm.initd-2 5455 RMD160 d88b99f7b4e7f181ad7c5ee817b881e0f2f797b6 SHA1 d3656459d81e195e7c8d829f82d7a9a32f26592f SHA256 ea6567021649df1084e2bc136a12a067b8bdf70e44978c6e3560e37d47141a23
AUX xdm.initd-3 5333 RMD160 ff474273d00ba8388a945a51946714b45cf778d6 SHA1 29c67fd05e4596f2e980ce8b87d31c7cbfc7d8fc SHA256 ab688e8508a100cbe10230c216476bd6c068ae6f15b9361274eda762a6c59419
AUX xdm.start 3974 RMD160 67f3b69fc9c006146999271935e1ae06d093130a SHA1 12763e84e31632c0421159e8feca2f9855966b7b SHA256 151b697f62e335850118a5d7d113d83fb37f2a75407985cd1e433de93eb55ded
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
AUX xsession.env.d 1146 RMD160 876f5de1da358d796cbc6563e29cb9832e150e24 SHA1 d9390b8c4b4432e2e0131bec686c14557086a534 SHA256 56c732b131072376e8649efd16072461b21c9973d89bb125c95d793002c1a924
DIST xinit-1.0.8.tar.bz2 117049 RMD160 d01b299e6e96c2b5318aaec479c81670b94e2129 SHA1 0102d2fdc0df3d24077ba826cf57640da46140af SHA256 06c1049f6b63d1c368a1e03e2392097919b22ff24899e190de3577bffe6fe524
EBUILD xinit-1.0.8-r7.ebuild 2304 RMD160 d6c0f4d1dc879ac801b54d90f88240f0c0d8d2ed SHA1 8567db06a56baf6abf861038cb54aac3a8cb1e7d SHA256 e4932c96bef271428167abab6b9048521a49e6baed74e5b4f568e16f113a21cc
MISC Reasons 97 RMD160 a02c92052f8ec42ead47577b237d6a3329630007 SHA1 3805c1939206ba5982678e746bd737337042d03d SHA256 c68f00fa52d10ff345234867e98adaef7d38988e5e76fbafd9221ecd6fe6eda2
+2
View File
@@ -0,0 +1,2 @@
# Fabio Erculiani <lxnay@sabayonlinux.org>
Add our 00-xhost env file to fix hostname changes bug
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
# This makes hostname changes bullet-proof. We can consider safe to allow any local user to connect to the X server
xhost +
+107
View File
@@ -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
+61
View File
@@ -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
@@ -0,0 +1,148 @@
diff -urN xinit-1.0.4.orig/startx.cpp xinit-1.0.4/startx.cpp
--- xinit-1.0.4.orig/startx.cpp 2007-07-13 21:54:34.000000000 -0700
+++ xinit-1.0.4/startx.cpp 2007-07-13 21:55:49.000000000 -0700
@@ -64,8 +64,6 @@
userserverrc=$HOME/.xserverrc
sysserverrc=XINITDIR/xserverrc
-defaultclient=XTERM
-defaultserver=XSERVER
defaultclientargs=""
defaultserverargs=""
clientargs=""
@@ -107,60 +105,41 @@
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"
- else
- server=$defaultserver
- fi
+if [ x"$serverargs" = x ]; then
+ serverargs="$defaultserverargs"
fi
if [ x"$XAUTHORITY" = x ]; then
@@ -217,15 +196,8 @@
#endif
-#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"$removelist" != x ]; then
XAUTH remove $removelist
@@ -251,3 +223,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.4.orig/xinit.c xinit-1.0.4/xinit.c
--- xinit-1.0.4.orig/xinit.c 2007-07-13 21:54:34.000000000 -0700
+++ xinit-1.0.4/xinit.c 2007-07-13 21:59:14.000000000 -0700
@@ -423,6 +423,7 @@
sigaction(SIGINT, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
signal(SIGALRM, sigAlarm);
signal(SIGUSR1, sigUsr1);
@@ -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);
@@ -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=""
+30
View File
@@ -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
+14
View File
@@ -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.2 2009/09/17 16:30:22 williamh Exp $
depend() {
need localmount
}
start() {
if get_bootparam "nox" ; then
touch /etc/init.d/.noxdm
fi
}
+12
View File
@@ -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"
+204
View File
@@ -0,0 +1,204 @@
#!/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-1,v 1.4 2008/01/13 22:27:32 philantrop 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
# 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) 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 lircd
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=
;;
*)
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
fi
}
cmdline_opt() {
if [ $# -ne 1 ] || ! [ -r /proc/cmdline ]; then
return 1
fi
for opt in $(cat /proc/cmdline) ; do
[ "${opt}" = "${1}" ] && return 0
done
return 1
}
# 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 cmdline_opt nox ; then
einfo "Skipping ${EXE}, received 'nox'"
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 :
+213
View File
@@ -0,0 +1,213 @@
#!/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-2,v 1.3 2009/08/31 09:09:18 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
# Start X Font Server before X
depend() {
need localmount
# 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
}
cmdline_opt() {
if [ $# -ne 1 ] || ! [ -r /proc/cmdline ]; then
return 1
fi
for opt in $(cat /proc/cmdline) ; do
[ "${opt}" = "${1}" ] && return 0
done
return 1
}
# 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 cmdline_opt nox ; then
einfo "Skipping ${EXE}, received 'nox'"
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 :
+202
View File
@@ -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.2 2009/09/15 00:27:45 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 ] ; then
einfo "Skipping ${EXE}, /etc/init.d/.noxdm found"
rm /etc/init.d/.noxdm
return 1
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 :
+164
View File
@@ -0,0 +1,164 @@
#!/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.start,v 1.11 2006/11/22 20:08:45 dberkholz 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
# 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) Could use lirc mouse as input device
# (#70689 comment #92) Start after consolefont to avoid display corruption
after bootmisc readahead-list ypbind autofs openvpn gpm netmount lircd consolefont
before alsasound net.lo
# Start before X
use acpid hald xfs
}
setup_dm() {
source /etc/profile.env
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
local MY_XDM="$(echo ${DISPLAYMANAGER} | awk '{ print tolower($1) }')"
case "${MY_XDM}" in
kdm|kde|kde2|kde3)
EXE="$(which kdm)"
;;
entrance*)
EXE="$(which entranced)"
;;
gdm|gnome)
EXE=/usr/bin/gdm
;;
wdm)
EXE=/usr/bin/wdm
;;
*)
EXE=
# Fix #65586, where MY_XDM is empty so EXE=somedir
[ -x "/usr/bin/${MY_XDM}" -a -f "/usr/bin/${MY_XDM}" ] \
&& EXE="/usr/bin/${MY_XDM}"
[ -z "${EXE}" ] && EXE="/usr/bin/xdm"
;;
esac
test ! -x "${EXE}" && EXE=/usr/bin/xdm
SERVICE="${EXE##*/}"
}
cmdline_opt() {
if [[ "$#" -ne 1 ]]; then
return 1
fi
for opt in $(</proc/cmdline); do
case ${opt} in
${1}) eval ${1}="true" ;;
esac
done
}
nox() {
# Don't start X if we were passed 'nox' at boot (#83680)
cmdline_opt nox
if [[ "$?" -ne 0 ]]; then
return 1
fi
if [[ -n "${nox}" ]]; then
return 0
else
return 1
fi
}
start() {
setup_dm
if nox; then
einfo "Skipping ${EXE}, received 'nox'"
else
ebegin "Setting up ${SERVICE}"
#save the prefered DM
save_options "service" "${EXE}"
# Start as soon as possible if XSTATICVT is set
if [ "${XSTATICVT}" = "yes" ] ; then
/etc/X11/startDM.sh
else
#tell init to run /etc/X11/startDM.sh after current
#runlevel is finished (should *not* be in the "boot"
# runlevel).
/sbin/telinit a &>/dev/null
fi
eend 0
fi
}
stop() {
local retval=0
local curvt="$(fgconsole)"
local myexe="$(get_options "service")"
local myservice="${myexe##*/}"
ebegin "Stopping ${myservice}"
rm -f ${svcdir}/options/xdm/service
if [ "$(ps -A | grep -e "${myservice}")" ]
then
start-stop-daemon --stop --quiet \
--exec ${myexe} &>/dev/null
retval=$?
fi
#switch back to original vt
chvt "${curvt}" &>/dev/null
eend ${retval} "Error stopping ${myservice}."
return ${retval}
}
# vim:ts=4
@@ -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;
}
}
+50
View File
@@ -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
+5
View File
@@ -0,0 +1,5 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth required pam_permit.so
account required pam_permit.so
+25
View File
@@ -0,0 +1,25 @@
# /etc/env.d/90xsession
# XSESSION is a new variable to control what window manager to start
# default with X if run with xdm, startx or xinit. The default behavior
# is to look in /etc/X11/Sessions/ and run the script in matching the
# value that XSESSION is set to. The support scripts are smart enough to
# look in all bin directories if it cant find a match in /etc/X11/Sessions/,
# so setting it to "enlightenment" can also work. This is basically used
# as a way for the system admin to configure a default system wide WM,
# allthough it will work if the user export XSESSION in his .bash_profile, etc.
#
# NOTE: 1) this behaviour is overridden when a ~/.xinitrc exists, and startx
# is called.
# 2) even if ~/.xsession exists, if XSESSION can be resolved, it will
# be executed rather than ~/.xsession, else KDM breaks ...
#
# Defaults depending on what you install currently include:
#
# Gnome - will start gnome-session
# kde-<version> - will start startkde (look in /etc/X11/Sessions/)
# Xfce4 - will start a XFCE4 session
# Xsession - will start a terminal and a few other nice apps
#XSESSION="Gnome"
+73
View File
@@ -0,0 +1,73 @@
# 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-r7.ebuild,v 1.1 2009/09/17 16:30:22 williamh 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="hal minimal pam"
RDEPEND="x11-apps/xauth
x11-libs/libX11
hal? ( sys-auth/consolekit sys-apps/dbus[X] )"
DEPEND="${RDEPEND}"
PDEPEND="!minimal? ( x11-wm/twm
x11-apps/xclock
x11-apps/xrdb
x11-apps/xsm
x11-terms/xterm )"
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 hal 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
dodir /etc/X11/xinit/xinitrc.d
exeinto /etc/X11/xinit/xinitrc.d/
doexe "${FILESDIR}/00-xhost"
}
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"
}