open-src/data/smf-rbac/x11-server
author Alan Coopersmith <Alan.Coopersmith@Sun.COM>
Sat, 05 Dec 2009 22:13:03 -0800
changeset 851 d428083dbbdd
parent 214 dea2a0e2c5bf
child 919 425233ae7236
permissions -rw-r--r--
6905171 X11R7.5 / Xorg 1.7.3 integration 6907686 Move X files from /usr/X11 to /usr [PSARC 2009/482] 6907695 Mesa & OpenGL switcher for SPARC [LSARC 2009/569] 6742737 deliver xf86-input-synaptics

#!/bin/ksh
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, provided that the above
# copyright notice(s) and this permission notice appear in all copies of
# the Software and that both the above copyright notice(s) and this
# permission notice appear in supporting documentation.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Except as contained in this notice, the name of a copyright holder
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in this Software without prior written authorization
# of the copyright holder.
#

USAGE="Usage: $0 [-d <display>] [-c <class>] <method> [-- <X server arguments>]"

PATH=/usr/bin:/usr/sbin:/usr/openwin/bin:/usr/X11/bin

#########
#
# Default values
# 
# Users must not modify this script to change them - change via SMF properties
#

DISPLAY="0"
CLASSES=""

while getopts c:d: opt; do
    case $opt in
	c)	if [ "$OPTARG" != "default" ] ; then
		    CLASSES="$CLASSES -c $OPTARG"
		fi ;;
	d)	DISPLAY="$OPTARG";;
	?)	echo $USAGE ; exit 2;;
    esac
done

shift `expr $OPTIND - 1`

METHOD=$1
if [ $# -lt 1 ] ; then
    echo $USAGE
    exit 2
fi
shift

case $METHOD in
    start)
	# Continue with rest of script
	;;
    *)
	echo "Invalid method $METHOD"
	exit 2
	;;
esac

if [ "$1" = "--" ] ; then
    shift
else
    if [ "$1" != "" ] ; then
	echo $USAGE
	exit 2
    fi
fi

# If the X server is started with SIGUSR1 set to ignore, then it
# sends SIGUSR1 to its parent process when it is ready to run
Xserver_ready() {
    exit 0
}

trap Xserver_ready USR1
(trap '' USR1 ; exec /usr/bin/Xserver $CLASSES :$DISPLAY $* &)