3 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
4 # Use is subject to license terms.
8 # The contents of this file are subject to the terms of the
9 # Common Development and Distribution License (the "License").
10 # You may not use this file except in compliance with the License.
12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 # or http://www.opensolaris.org/os/licensing.
14 # See the License for the specific language governing permissions
15 # and limitations under the License.
17 # When distributing Covered Code, include this CDDL HEADER in each
18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 # If applicable, add the following below this CDDL HEADER, with the
20 # fields enclosed by brackets "[]" replaced with your own identifying
21 # information: Portions Copyright [yyyy] [name of copyright owner]
25 # Start script for vntsd
27 # For modifying parameters passed to vntsd, do not edit
28 # this script. Instead use svccfg(1m) to modify the SMF
29 # repository. For example:
32 # svc:> select ldoms/vntsd
33 # svc:/ldoms/vntsd> setprop vntsd/vcc_device = "virtual-console-concentrator@1"
34 # svc:/ldoms/vntsd> setprop vntsd/listen_addr = "192.168.1.1"
35 # svc:/ldoms/vntsd> setprop vntsd/authorization="true"
36 # svc:/ldoms/vntsd> exit
38 .
/lib
/svc
/share
/smf_include.sh
40 AUTH_ATTR
=/etc
/security
/auth_attr
41 USER_ATTR
=/etc
/user_attr
45 SVCCFG
=/usr
/sbin
/svccfg
49 # Add LDoms vntsd authorization entries to etc/security/auth_attr if not
50 # present. These define authorizations used by LDoms vntsd daemon.
54 # Add entries to auth_attr file, if needed
55 $GREP '^solaris.vntsd.:' ${AUTH_ATTR} >/dev
/null
2>&1
56 if [ $?
-ne 0 ] ; then
57 $CAT >>${AUTH_ATTR} << EOF
59 solaris.vntsd.:::LDoms vntsd Administration::
60 solaris.vntsd.grant:::Delegate LDoms vntsd Administration::
61 solaris.vntsd.consoles:::Access All LDoms Guest Consoles::
68 # Add a LDoms user/role entry to etc/user_attr if not present.
69 # This defines user/role used by useradd or roleadd.
74 # Add entries to user_attr file, if needed.
76 $GREP 'solaris.vntsd.grant' ${USER_ATTR} >/dev
/null
2>&1
78 if [ $?
-ne 0 ] ; then
80 $GREP '^root' ${USER_ATTR} |
$GREP 'auths=' >/dev
/null
2>&1
81 if [ $?
-eq 0 ] ; then
83 # Add vntsd attribute to an existing root entry.
85 $ED -s ${USER_ATTR} <<- EOF > /dev/null 2>&1
86 g/^root.*auths\=/s/^roo.*auths\=/&solaris.vntsd.grant,/
92 # Add a root entry with vntsd attribute.
94 $CAT >>${USER_ATTR} << EOF
96 root::::type=normal;auths=solaris.vntsd.grant;lock_after_retries=0
104 # Update 'vntsd' authorizations in the relevant files. Note that adding these
105 # entries from this smf script rather than from the pkg install scripts,
106 # ensures that they are added only if the vntsd service is being enabled; and
107 # hence avoids adding these entries unnecessarily into client guest domains.
108 # The functions check before adding, that the entries are not already present.
113 vcc_device
=`$SVCPROP -p vntsd/vcc_device $SMF_FMRI 2>/dev/null`
114 if [ -z "$vcc_device" ]; then
115 vcc_device
="virtual-console-concentrator@0"
117 args
="-i $vcc_device"
119 listen_addr
=`$SVCPROP -p vntsd/listen_addr $SMF_FMRI 2>/dev/null`
120 if [ -n "$listen_addr" ]; then
121 args
="$args -p $listen_addr"
124 timeout
=`$SVCPROP -p vntsd/timeout_minutes $SMF_FMRI 2>/dev/null`
125 if [ -n "$timeout" ]; then
126 args
="$args -t $timeout"
129 auth
=`$SVCPROP -p vntsd/authorization $SMF_FMRI 2>/dev/null`
130 if [ "$auth" = "true" ]; then
135 # If we don't have a vcc device we don't want to try to start vntsd. By default
136 # newer versions of the factory settings will try to start vntsd by default.
137 # Since we may be installed on a machine with an older firmware we need to make
138 # sure that we don't try to start if the virtual console concentrator is not
141 VNTSD_DEV
='/devices/virtual-devices@100/channel-devices@200/virtual-console-concentrator@0:ctl'
142 if [ ! -c "$VNTSD_DEV" ]; then
143 echo "The Virtual Network Terminal Server service has been disabled" \
144 "because the system has no virtual console concentrator (vcc)" \
146 /usr
/sbin
/svcadm disable
-t "$SMF_FMRI"
151 if [ -x /usr
/lib
/ldoms
/vntsd
]; then
152 /usr
/lib
/ldoms
/vntsd
$args
154 if [ $rc -ne 0 ]; then
155 # if vntsd exited in error with status 1, let SMF restart it
156 # otherwise we want it to go into maintenance.
157 if [ $rc -eq 1 ]; then
164 echo "WARNING: /usr/lib/ldoms/vntsd is missing or not executable" >& 2
165 exit $SMF_EXIT_ERR_CONFIG