xref: /titanic_41/usr/src/cmd/svc/milestone/console-login (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
1#!/sbin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"%Z%%M%	%I%	%E% SMI"
28#
29# For modifying parameters passed to ttymon, do not edit
30# this script. Instead use svccfg(1m) to modify the SMF
31# repository. For example:
32#
33# # svccfg
34# svc:> select system/console-login
35# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
36# svc:/system/console-login> exit
37
38getproparg() {
39	val=`svcprop -p $2 $SMF_FMRI`
40	[ -n "$val" ] && [ "$val" != "\"\"" ] && echo $1 $val
41}
42
43args="-g"
44
45val=`svcprop -p ttymon/device $SMF_FMRI`
46# if this isn't set, recover a little
47[ -z "$val" ] && val=/dev/console
48args="$args -d $val"
49
50args="$args `getproparg -l ttymon/label`"
51
52args="$args `getproparg -T ttymon/terminal_type`"
53
54args="$args `getproparg -m ttymon/modules`"
55
56val=`svcprop -p ttymon/nohangup $SMF_FMRI`
57[ "$val" = "true" ] && args="$args -h"
58
59val=`svcprop -p ttymon/timeout $SMF_FMRI`
60[ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
61
62val=`svcprop -p ttymon/prompt $SMF_FMRI`
63if [ -n "$val" ]; then
64	prompt=`eval echo $val`
65	exec /usr/lib/saf/ttymon $args -p "`eval echo $prompt` "
66else
67	exec /usr/lib/saf/ttymon $args
68fi
69