Xserver revision 970
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Permission is hereby granted, free of charge, to any person obtaining a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# copy of this software and associated documentation files (the "Software"),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# to deal in the Software without restriction, including without limitation
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# and/or sell copies of the Software, and to permit persons to whom the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Software is furnished to do so, subject to the following conditions:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# The above copyright notice and this permission notice (including the next
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# paragraph) shall be included in all copies or substantial portions of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# DEALINGS IN THE SOFTWARE.
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterUSAGE="Usage: $0 [-c <class>] :<display> [<X server arguments>]"
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington# Default values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Users must not modify this script to change them - change via SMF properties
a82d04bc19fee9d5e34b41ccd7641da1f62ab634Neil Maddenwhile getopts :c: opt; do
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington # Strip leading ":" from $1 to get display number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# 1) name of SMF property to find in one of the service instances
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# 2) name of variable to store the value of the property in, if found
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Also sets variable with name of $2_INSTANCE to the service instance the
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington# property was found in, for use in later messages.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # Make ${propval} be a reference to the variable named as the second arg
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # The "" instance is to get the properties from the base service without
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for instance in ":display${DISPLAY}" ${CLASSES} "" ; do
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster propinst="svc:/application/x11/x11-server${instance}"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterif [[ -f ${XSERVER} ]] ; then
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # Canonicalize path, so that we don't break people who specified path
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # via the /usr/X -> openwin or X11 link
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # Automatically select replacements for removed X servers
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Specified server ${XSERVER} not found, using ${newserver} instead.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster To correct this warning, change the server property with
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Make sure ${XSERVER} is a known X server binary
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/bin/Xorg) return 0 ;;
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington /usr/bin/amd64/Xorg) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/bin/i86/Xorg) return 0 ;;
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington /usr/bin/Xvfb) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/bin/amd64/Xvfb) return 0 ;;
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington /usr/bin/i86/Xvfb) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/bin/Xvnc) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/openwin/bin/Xsun) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /usr/openwin/bin/Xvfb) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /opt/SUNWut/lib/Xnewt) return 0 ;;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterif ! is_known_xserver "${ORIGINAL_XSERVER}" ; then
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fatal_error "${XSERVER} is not a valid X server"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # Xsun based
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster # Xorg based
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster# Should not happen, but just in case
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterif [[ ("${CONSOLE}" == "true") && ("${DISPLAY}" == "0") ]] ; then
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} $*"