xref: /illumos-gate/usr/src/cmd/svc/milestone/console-login (revision 80ab886d233f514d54c2a6bdeb9fdfd951bd6881)
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
38FMRI=svc:/system/console-login
39
40getproparg() {
41	val=`svcprop -p $2 $FMRI`
42	[ -n "$val" ] && [ "$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`"
53
54args="$args `getproparg -T ttymon/terminal_type`"
55
56args="$args `getproparg -m ttymon/modules`"
57
58val=`svcprop -p ttymon/nohangup $FMRI`
59[ "$val" = "true" ] && args="$args -h"
60
61val=`svcprop -p ttymon/timeout $FMRI`
62[ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
63
64val=`svcprop -p ttymon/prompt $FMRI`
65if [ -n "$val" ]; then
66	prompt=`eval echo $val`
67	exec /usr/lib/saf/ttymon $args -p "`eval echo $prompt` "
68else
69	exec /usr/lib/saf/ttymon $args
70fi
71