dtstart revision 20819
970N/A#!/bin/bash
1153N/A#
970N/A# Script for starting a desktop session
970N/A#
970N/A# CDDL HEADER START
970N/A#
970N/A# The contents of this file are subject to the terms of the
970N/A# Common Development and Distribution License, Version 1.0 only
970N/A# (the "License"). You may not use this file except in compliance
970N/A# with the License.
970N/A#
970N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
970N/A# or http://www.opensolaris.org/os/licensing.
970N/A# See the License for the specific language governing permissions
970N/A# and limitations under the License.
970N/A#
970N/A# When distributing Covered Code, include this CDDL HEADER in each
970N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
970N/A# If applicable, add the following below this CDDL HEADER, with the
970N/A# fields enclosed by brackets "[]" replaced with your own identifying
970N/A# information: Portions Copyright [yyyy] [name of copyright owner]
970N/A#
970N/A# CDDL HEADER END
1153N/A#
1153N/A#
1153N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
1190N/A# Use is subject to license terms.
1190N/A#
1190N/A
1190N/AMYNAME=$(basename $0)
1190N/A
1153N/Ausage() {
1190N/A echo "Usage: $0 session_name"
1153N/A echo " This script loads scripts in /etc/X11/xinit/xinitrc.d"
970N/A echo " and runs a session manager."
1153N/A echo " session_name is gnome, twm or xdm"
1153N/A}
1153N/A
1190N/Aif [ $# -ne 1 ]; then
1190N/A usage
1190N/A exit 1
1190N/Afi
1190N/A
1190N/Acase "$1" in
1190N/A -h|--help|-\?)
1190N/A usage
1190N/A exit 0
1190N/A ;;
1190N/Aesac
1190N/A
1190N/ASESSION_NAME="$1"
1190N/Ashift
1190N/A
1207N/Acase "$SESSION_NAME" in
1190N/Agdm|GDM|gnome|GNOME|jds|JDS)
1190N/A SESSION_MANAGER=/usr/bin/gnome-session ;;
1190N/Atjds|TJDS|TrustedJDS|tgnome|TGNOME)
1207N/A SESSION_MANAGER='/usr/bin/gnome-session --trusted-session';;
1190N/Atwm|TWM) SESSION_MANAGER=/usr/bin/twm ;;
1190N/Axdm|XDM) SESSION_MANAGER=/usr/lib/X11/xdm/Xsession ;;
1153N/Aconsole) exit 0 ;;
1207N/A*)
1190N/A if [ "x$SESSION_NAME" != x ] ; then
970N/A SESSION_MANAGER=$SESSION_NAME
1153N/A fi
1190N/A if [ ! -x $SESSION_NAME ] ; then
1153N/A echo "Could not find session startup for $SESSION_NAME"
1153N/A SESSION_MANAGER=/usr/bin/twm
1153N/A fi
1154N/A
1153N/Aesac
1153N/A
1153N/A# GDM slave sets DESKTOP_SESSION environment from .desktop file.
1153N/Aexport DESKTOP_SESSION=$SESSION_NAME
1207N/A
1153N/A# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for i in /etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
done
fi
exec $SESSION_MANAGER $@