xref: /onnv-gate/usr/src/cmd/svc/milestone/console-login (revision 7688:2757e6e1bb2a)
10Sstevel@tonic-gate#!/sbin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
61253Slq150181# Common Development and Distribution License (the "License").
71253Slq150181# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
221253Slq150181
230Sstevel@tonic-gate#
24*7688SAaron.Zang@Sun.COM# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate# Use is subject to license terms.
260Sstevel@tonic-gate#
27*7688SAaron.Zang@Sun.COM# This method script manages all vt logins including system
28*7688SAaron.Zang@Sun.COM# console login.
290Sstevel@tonic-gate#
300Sstevel@tonic-gate# For modifying parameters passed to ttymon, do not edit
310Sstevel@tonic-gate# this script. Instead use svccfg(1m) to modify the SMF
320Sstevel@tonic-gate# repository. For example:
330Sstevel@tonic-gate#
340Sstevel@tonic-gate# # svccfg
350Sstevel@tonic-gate# svc:> select system/console-login
360Sstevel@tonic-gate# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
370Sstevel@tonic-gate# svc:/system/console-login> exit
380Sstevel@tonic-gate
39*7688SAaron.Zang@Sun.COM. /lib/svc/share/smf_include.sh
40*7688SAaron.Zang@Sun.COM
41*7688SAaron.Zang@Sun.COMif [ "$1" != "default" ]; then
42*7688SAaron.Zang@Sun.COM	if smf_dont_configure_vt; then
43*7688SAaron.Zang@Sun.COM		/usr/sbin/svcadm disable $SMF_FMRI
44*7688SAaron.Zang@Sun.COM		exit $SMF_EXIT_OK
45*7688SAaron.Zang@Sun.COM	fi
46*7688SAaron.Zang@Sun.COMfi
47*7688SAaron.Zang@Sun.COM
480Sstevel@tonic-gategetproparg() {
492589Shshaw	val=`svcprop -p $2 $SMF_FMRI`
501253Slq150181	[ -n "$val" ] && [ "$val" != "\"\"" ] && echo $1 $val
510Sstevel@tonic-gate}
520Sstevel@tonic-gate
530Sstevel@tonic-gateargs="-g"
540Sstevel@tonic-gate
552589Shshawval=`svcprop -p ttymon/device $SMF_FMRI`
560Sstevel@tonic-gate# if this isn't set, recover a little
57*7688SAaron.Zang@Sun.COM[ -z "$val" ] && val="/dev/console"
58*7688SAaron.Zang@Sun.COM
59*7688SAaron.Zang@Sun.COMif [ "$val" = "/dev/vt/1" ]; then
60*7688SAaron.Zang@Sun.COM	echo "ERROR: ttymon/device cannot be configured to /dev/vt/1."
61*7688SAaron.Zang@Sun.COM	exit $SMF_EXIT_ERR_CONFIG
62*7688SAaron.Zang@Sun.COMfi
63*7688SAaron.Zang@Sun.COM
640Sstevel@tonic-gateargs="$args -d $val"
650Sstevel@tonic-gate
660Sstevel@tonic-gateargs="$args `getproparg -l ttymon/label`"
671253Slq150181
680Sstevel@tonic-gateargs="$args `getproparg -T ttymon/terminal_type`"
691253Slq150181
700Sstevel@tonic-gateargs="$args `getproparg -m ttymon/modules`"
710Sstevel@tonic-gate
722589Shshawval=`svcprop -p ttymon/nohangup $SMF_FMRI`
730Sstevel@tonic-gate[ "$val" = "true" ] && args="$args -h"
740Sstevel@tonic-gate
752589Shshawval=`svcprop -p ttymon/timeout $SMF_FMRI`
760Sstevel@tonic-gate[ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
770Sstevel@tonic-gate
782589Shshawval=`svcprop -p ttymon/prompt $SMF_FMRI`
790Sstevel@tonic-gateif [ -n "$val" ]; then
800Sstevel@tonic-gate	prompt=`eval echo $val`
810Sstevel@tonic-gate	exec /usr/lib/saf/ttymon $args -p "`eval echo $prompt` "
820Sstevel@tonic-gateelse
830Sstevel@tonic-gate	exec /usr/lib/saf/ttymon $args
840Sstevel@tonic-gatefi
85