xref: /titanic_41/usr/src/cmd/svc/milestone/console-login (revision aecfc01d1bad84e66649703f7fc2926ef70b34ba)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6fea9cb91Slq150181# Common Development and Distribution License (the "License").
7fea9cb91Slq150181# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
22fea9cb91Slq150181
237c478bd9Sstevel@tonic-gate#
24*aecfc01dSrui zang - Sun Microsystems - Beijing China# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate# Use is subject to license terms.
267c478bd9Sstevel@tonic-gate#
27*aecfc01dSrui zang - Sun Microsystems - Beijing China# This method script manages all vt logins including system
28*aecfc01dSrui zang - Sun Microsystems - Beijing China# console login.
297c478bd9Sstevel@tonic-gate#
307c478bd9Sstevel@tonic-gate# For modifying parameters passed to ttymon, do not edit
317c478bd9Sstevel@tonic-gate# this script. Instead use svccfg(1m) to modify the SMF
327c478bd9Sstevel@tonic-gate# repository. For example:
337c478bd9Sstevel@tonic-gate#
347c478bd9Sstevel@tonic-gate# # svccfg
357c478bd9Sstevel@tonic-gate# svc:> select system/console-login
367c478bd9Sstevel@tonic-gate# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
377c478bd9Sstevel@tonic-gate# svc:/system/console-login> exit
387c478bd9Sstevel@tonic-gate
39*aecfc01dSrui zang - Sun Microsystems - Beijing China. /lib/svc/share/smf_include.sh
40*aecfc01dSrui zang - Sun Microsystems - Beijing China
41*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaif [ "$1" != "default" ]; then
42*aecfc01dSrui zang - Sun Microsystems - Beijing China	if smf_dont_configure_vt; then
43*aecfc01dSrui zang - Sun Microsystems - Beijing China		/usr/sbin/svcadm disable $SMF_FMRI
44*aecfc01dSrui zang - Sun Microsystems - Beijing China		exit $SMF_EXIT_OK
45*aecfc01dSrui zang - Sun Microsystems - Beijing China	fi
46*aecfc01dSrui zang - Sun Microsystems - Beijing Chinafi
47*aecfc01dSrui zang - Sun Microsystems - Beijing China
487c478bd9Sstevel@tonic-gategetproparg() {
49a1e4d62bShshaw	val=`svcprop -p $2 $SMF_FMRI`
50fea9cb91Slq150181	[ -n "$val" ] && [ "$val" != "\"\"" ] && echo $1 $val
517c478bd9Sstevel@tonic-gate}
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateargs="-g"
547c478bd9Sstevel@tonic-gate
55a1e4d62bShshawval=`svcprop -p ttymon/device $SMF_FMRI`
567c478bd9Sstevel@tonic-gate# if this isn't set, recover a little
57*aecfc01dSrui zang - Sun Microsystems - Beijing China[ -z "$val" ] && val="/dev/console"
58*aecfc01dSrui zang - Sun Microsystems - Beijing China
59*aecfc01dSrui zang - Sun Microsystems - Beijing Chinaif [ "$val" = "/dev/vt/1" ]; then
60*aecfc01dSrui zang - Sun Microsystems - Beijing China	echo "ERROR: ttymon/device cannot be configured to /dev/vt/1."
61*aecfc01dSrui zang - Sun Microsystems - Beijing China	exit $SMF_EXIT_ERR_CONFIG
62*aecfc01dSrui zang - Sun Microsystems - Beijing Chinafi
63*aecfc01dSrui zang - Sun Microsystems - Beijing China
647c478bd9Sstevel@tonic-gateargs="$args -d $val"
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gateargs="$args `getproparg -l ttymon/label`"
67fea9cb91Slq150181
687c478bd9Sstevel@tonic-gateargs="$args `getproparg -T ttymon/terminal_type`"
69fea9cb91Slq150181
707c478bd9Sstevel@tonic-gateargs="$args `getproparg -m ttymon/modules`"
717c478bd9Sstevel@tonic-gate
72a1e4d62bShshawval=`svcprop -p ttymon/nohangup $SMF_FMRI`
737c478bd9Sstevel@tonic-gate[ "$val" = "true" ] && args="$args -h"
747c478bd9Sstevel@tonic-gate
75a1e4d62bShshawval=`svcprop -p ttymon/timeout $SMF_FMRI`
767c478bd9Sstevel@tonic-gate[ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
777c478bd9Sstevel@tonic-gate
78a1e4d62bShshawval=`svcprop -p ttymon/prompt $SMF_FMRI`
797c478bd9Sstevel@tonic-gateif [ -n "$val" ]; then
807c478bd9Sstevel@tonic-gate	prompt=`eval echo $val`
817c478bd9Sstevel@tonic-gate	exec /usr/lib/saf/ttymon $args -p "`eval echo $prompt` "
827c478bd9Sstevel@tonic-gateelse
837c478bd9Sstevel@tonic-gate	exec /usr/lib/saf/ttymon $args
847c478bd9Sstevel@tonic-gatefi
85