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