xref: /titanic_41/usr/src/cmd/svc/milestone/console-login (revision c138f478d2bc94e73ab8f6a084e323bec25e62f5)
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, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2004 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
38FMRI=svc:/system/console-login
39
40getproparg() {
41	val=`svcprop -p $2 $FMRI`
42	[ -n "$val" ] && echo $1 $val
43}
44
45args="-g"
46
47val=`svcprop -p ttymon/device $FMRI`
48# if this isn't set, recover a little
49[ -z "$val" ] && val=/dev/console
50args="$args -d $val"
51
52args="$args `getproparg -l ttymon/label`"
53args="$args `getproparg -T ttymon/terminal_type`"
54args="$args `getproparg -m ttymon/modules`"
55
56val=`svcprop -p ttymon/nohangup $FMRI`
57[ "$val" = "true" ] && args="$args -h"
58
59val=`svcprop -p ttymon/timeout $FMRI`
60[ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
61
62val=`svcprop -p ttymon/prompt $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