diff options
author | Stefan Cristian B. <steven.darklight@gmail.com> | 2014-11-30 02:52:29 +0200 |
---|---|---|
committer | Stefan Cristian B. <steven.darklight@gmail.com> | 2014-11-30 02:52:29 +0200 |
commit | d0bb85a9d04b090c8850155750b5775fba6ef32b (patch) | |
tree | d8809f7910970831cbd92068c10842081cce90ca /x11-apps/xinit/files/chooser.sh | |
parent | 1ef8e53a80beb163ec407536582da6d11e4fa737 (diff) | |
parent | 320eacba135418ed594f4bf56d1b800450684e32 (diff) |
Merge pull request #10 from V3n3RiX/master
fix one 8 year long standing bug in xinit/startx
Diffstat (limited to 'x11-apps/xinit/files/chooser.sh')
-rwxr-xr-x | x11-apps/xinit/files/chooser.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/x11-apps/xinit/files/chooser.sh b/x11-apps/xinit/files/chooser.sh new file mode 100755 index 00000000..f24be46d --- /dev/null +++ b/x11-apps/xinit/files/chooser.sh @@ -0,0 +1,52 @@ +#!/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.5 2009/11/14 14:18:43 scarabeus Exp $ + +# 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 |