open-src/xserver/xserver-common/Xserver
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Thu, 21 Oct 2010 14:40:25 -0700
changeset 1018 baa7bc85407b
parent 970 272328fe1b4a
child 1097 243d7ed7a10c
permissions -rw-r--r--
6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
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
#
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     4
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
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
    builtin -f libcmd.so.1 readlink && \
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
    XSERVER=$(readlink -f ${XSERVER})
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
    # 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
   132
    case ${XSERVER} in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
	*/Xsun)	
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
	    newserver="/usr/bin/Xorg" 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
	*/Xvfb)	
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
	    newserver="/usr/bin/Xvfb" 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   138
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   139
	*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   140
	    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
   141
	    ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   142
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   143
    cat 1>&2 <<#EOF 
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   144
	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
   145
	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
   146
	  /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
   147
		setprop options/server == ${newserver}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
	EOF
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
    XSERVER="${newserver}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
# 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
   154
function is_known_xserver {
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
    case "$1" in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
	/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
   157
	/usr/bin/amd64/Xorg)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
	/usr/bin/i86/Xorg)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
	/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
   160
	/usr/bin/amd64/Xvfb)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   161
	/usr/bin/i86/Xvfb)		return 0 ;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
	/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
   163
	/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
   164
	/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
   165
	/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
   166
    esac
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
    return 1
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
}
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
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
   171
    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
   172
	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
   173
    fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
case ${XSERVER} in
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
    # Xsun based
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
    /usr/openwin/bin/*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
	DEPTHARG="-defdepth ${DEFDEPTH:-24}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
	;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
    # Xorg based
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
    /usr/bin/*)
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   183
	if [[ "${DEFDEPTH}" != "" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   184
	    DEPTHARG="-depth ${DEFDEPTH}"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
	fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
	;;
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
esac
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
# 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
   190
if [[ "${TCP_LISTEN}" == "" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   191
    if [[ "${REMOTE}" == "true" ]] ; then
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   192
	TCP_LISTEN="true"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   193
    else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   194
	TCP_LISTEN="false"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   195
    fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   196
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   197
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   198
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
   199
    LISTENARG="-nolisten tcp"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   200
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   201
    LISTENARG=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   202
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   203
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   204
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
   205
    CONSOLE="-C"
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   206
else
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   207
    CONSOLE=""
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   208
fi
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   209
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
   210
# 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
   211
# 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
   212
# 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
   213
# 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
   214
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
   215
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
   216
    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
   217
	*/*)	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
   218
    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
   219
    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
   220
	*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
   221
    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
   222
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
   223
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
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
   225
272328fe1b4a 6941932 X should be able to build IPS packages natively
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   226
exec ${XSERVER} :${DISPLAY} ${ALLARGS}