open-src/xserver/xserver-common/Xserver
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Mon, 18 Jul 2011 13:01:21 -0700
changeset 1165 7423a7b0645e
parent 1097 243d7ed7a10c
permissions -rw-r--r--
7066497 Xserver script shouldn't use readlink builtin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     1
#!/bin/ksh93
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     2
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     3
#
1097
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
     4
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     5
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     6
# Permission is hereby granted, free of charge, to any person obtaining a
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     7
# copy of this software and associated documentation files (the "Software"),
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     8
# to deal in the Software without restriction, including without limitation
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     9
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    10
# and/or sell copies of the Software, and to permit persons to whom the
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    11
# Software is furnished to do so, subject to the following conditions:
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    12
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    13
# The above copyright notice and this permission notice (including the next
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    14
# paragraph) shall be included in all copies or substantial portions of the
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    15
# Software.
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    16
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    17
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    18
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    19
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    20
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    21
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    22
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    23
# DEALINGS IN THE SOFTWARE.
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    24
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    25
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    26
USAGE="Usage: $0 [-c <class>] :<display> [<X server arguments>]"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    27
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    28
PATH=/usr/bin:/usr/sbin
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    29
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    30
progname=$0
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    31
function fatal_error
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    32
{
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    33
    print -u2 "${progname}: $*"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    34
    exit 1
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    35
}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    36
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    37
#########
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    38
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    39
# Default values
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    40
# 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    41
# Users must not modify this script to change them - change via SMF properties
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    42
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    43
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    44
DISPLAY="0"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    45
DEFDEPTH=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    46
CLASSES=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    47
TCP_LISTEN=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    48
SERVERARGS=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    49
XSERVER="/usr/bin/Xorg"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    50
CONSOLE=""
1018
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
    51
CONFIG_FILE=""
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    52
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    53
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    54
while getopts :c: opt; do
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    55
    case $opt in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    56
	c)	CLASSES+=" :${OPTARG}" ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    57
	?)	print -u2 $USAGE ; exit 2;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    58
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    59
done
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    60
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    61
shift $((OPTIND - 1))
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    62
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    63
if (( $# > 1 )) ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    64
    case $1 in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    65
	:*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    66
	    # Strip leading ":" from $1 to get display number
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    67
	    DISPLAY="${1#:}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    68
	    shift
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    69
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    70
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    71
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    72
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    73
REMOTE="false"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    74
for a in $SERVERARGS "$*" ; do
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    75
    case $a in 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    76
	-query|-broadcast|-multicast|-indirect)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    77
	    REMOTE="true"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    78
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    79
	*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    80
	    # Do nothing
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    81
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    82
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    83
done
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    84
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    85
if [[ "${REMOTE}" == "true" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    86
    CLASSES+=" :remote"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    87
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    88
    CLASSES+=" :local"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    89
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    90
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    91
# Arguments:
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    92
#	1) name of SMF property to find in one of the service instances
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    93
#	2) name of variable to store the value of the property in, if found
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    94
# Also sets variable with name of $2_INSTANCE to the service instance the 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    95
# property was found in, for use in later messages.
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    96
function getprop {
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    97
    # Make ${propval} be a reference to the variable named as the second arg
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    98
    nameref propval=$2
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    99
    nameref propinst="${2}_INSTANCE"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   100
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   101
    # The "" instance is to get the properties from the base service without
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   102
    # any instance specifier
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   103
    for instance in ":display${DISPLAY}" ${CLASSES} "" ; do
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   104
	propinst="svc:/application/x11/x11-server${instance}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   105
	if svcprop -q -p $1 "${propinst}" ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   106
	    propval="$(svcprop -p $1 "${propinst}")"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   107
	    if [[ "${propval}" == "\"\"" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   108
		propval=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   109
	    fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   110
	    return 0
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   111
	fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   112
    done
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   113
    return 1
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   114
}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   115
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   116
getprop options/default_depth DEFDEPTH
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   117
getprop options/server XSERVER
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   118
getprop options/server_args SERVERARGS
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   119
getprop options/tcp_listen TCP_LISTEN
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   120
getprop options/display_0_on_console CONSOLE
1018
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   121
getprop options/config_file CONFIG_FILE
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   122
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   123
ORIGINAL_XSERVER="${XSERVER}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   124
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   125
if [[ -f ${XSERVER} ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   126
    # Canonicalize path, so that we don't break people who specified path
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   127
    # via the /usr/X -> openwin or X11 link
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   128
    XSERVER=$(readlink -f ${XSERVER})
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
    # Automatically select replacements for removed X servers
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
    case ${XSERVER} in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   132
	*/Xsun)	
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
	    newserver="/usr/bin/Xorg" 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
	*/Xvfb)	
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
	    newserver="/usr/bin/Xvfb" 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
	    ;;
1097
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   138
	/usr/bin/i86/*) # Map to same name in /usr/bin
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   139
	    newserver="/usr/bin/${XSERVER#/usr/bin/i86/}"
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   140
	    ;;
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   141
	/usr/bin/amd64/*) # Map to same name in /usr/bin
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   142
	    newserver="/usr/bin/${XSERVER#/usr/bin/amd64/}"
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   143
	    ;;
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   144
	*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   145
	    fatal_error "${XSERVER} is not an executable"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   146
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   147
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
    cat 1>&2 <<#EOF 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
	Specified server ${XSERVER} not found, using ${newserver} instead.
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
	To correct this warning, change the server property with
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
	  /usr/sbin/svccfg -s ${XSERVER_INSTANCE} \\
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
		setprop options/server == ${newserver}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
	EOF
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   154
    XSERVER="${newserver}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   157
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
# Make sure ${XSERVER} is a known X server binary
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
function is_known_xserver {
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   160
    case "$1" in
1097
243d7ed7a10c 6991718 Removal of 32-bit X servers [PSARC/2010/382]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 1018
diff changeset
   161
	/usr/bin/Xdmx)			return 0 ;;
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
	/usr/bin/Xorg)			return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   163
	/usr/bin/Xvfb)			return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   164
	/usr/bin/Xvnc)			return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   165
	/usr/openwin/bin/Xsun)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   166
	/usr/openwin/bin/Xvfb)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
	/opt/SUNWut/lib/Xnewt)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
    return 1
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   171
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   172
if ! is_known_xserver "${ORIGINAL_XSERVER}" ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   173
    if ! is_known_xserver "${XSERVER}" ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
	fatal_error "${XSERVER} is not a valid X server"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
    fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
case ${XSERVER} in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
    # Xsun based
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
    /usr/openwin/bin/*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
	DEPTHARG="-defdepth ${DEFDEPTH:-24}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
	;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   183
    # Xorg based
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   184
    /usr/bin/*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
	if [[ "${DEFDEPTH}" != "" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
	    DEPTHARG="-depth ${DEFDEPTH}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
	fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   188
	;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   189
esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   190
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   191
# Should not happen, but just in case
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   192
if [[ "${TCP_LISTEN}" == "" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   193
    if [[ "${REMOTE}" == "true" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   194
	TCP_LISTEN="true"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   195
    else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   196
	TCP_LISTEN="false"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   197
    fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   198
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   199
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   200
if [[ "${TCP_LISTEN}" == "false" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   201
    LISTENARG="-nolisten tcp"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   202
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   203
    LISTENARG=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   204
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   205
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   206
if [[ ("${CONSOLE}" == "true") && ("${DISPLAY}" == "0") ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   207
    CONSOLE="-C"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   208
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   209
    CONSOLE=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   210
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   211
1018
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   212
# Currently only Xorg accepts a command line flag for choosing config files.
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   213
# If other X servers add such flags in the future, they should be added here.
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   214
# Only filenames without directory paths are allowed (similar to when a 
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   215
# non-root user runs Xorg -config) to avoid security issues.
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   216
CONFIGARG=""
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   217
if [[ ! -z "${CONFIG_FILE}" ]] ; then
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   218
    case ${CONFIG_FILE} in
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   219
	*/*)	fatal_error "Illegal value for config_file property" ;;
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   220
    esac
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   221
    case ${XSERVER} in
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   222
	*Xorg)	CONFIGARG="-config ${CONFIG_FILE}" ;;
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   223
    esac
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   224
fi
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   225
baa7bc85407b 6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 970
diff changeset
   226
ALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} ${CONFIGARG} $*"
970
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   227
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   228
exec ${XSERVER} :${DISPLAY} ${ALLARGS}