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