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