8354 sync regcomp(3C) with upstream (fix make catalog)
[unleashed/tickless.git] / usr / src / cmd / svc / milestone / console-login
blobc7003b103bf08cbfdb8834be1f1ab9cb2409ca03
1 #!/sbin/sh
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 # This method script manages all vt logins including system
28 # console login.
30 # For modifying parameters passed to ttymon, do not edit
31 # this script. Instead use svccfg(1m) to modify the SMF
32 # repository. For example:
34 # # svccfg
35 # svc:> select system/console-login
36 # svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
37 # svc:/system/console-login> exit
39 . /lib/svc/share/smf_include.sh
41 if [ "$1" != "default" ]; then
42 if smf_dont_configure_vt; then
43 /usr/sbin/svcadm disable $SMF_FMRI
44 exit $SMF_EXIT_OK
48 getproparg() {
49 val=`svcprop -p $2 $SMF_FMRI`
50 [ -n "$val" ] && [ "$val" != "\"\"" ] && echo $1 $val
53 args="-g"
55 val=`svcprop -p ttymon/device $SMF_FMRI`
56 # if this isn't set, recover a little
57 [ -z "$val" ] && val="/dev/console"
59 if [ "$val" = "/dev/vt/1" ]; then
60 echo "ERROR: ttymon/device cannot be configured to /dev/vt/1."
61 exit $SMF_EXIT_ERR_CONFIG
64 args="$args -d $val"
66 args="$args `getproparg -l ttymon/label`"
68 args="$args `getproparg -T ttymon/terminal_type`"
70 args="$args `getproparg -m ttymon/modules`"
72 val=`svcprop -p ttymon/nohangup $SMF_FMRI`
73 [ "$val" = "true" ] && args="$args -h"
75 val=`svcprop -p ttymon/timeout $SMF_FMRI`
76 [ -n "$val" -a "$val" != "0" ] && args="$args -t $val"
78 val=`svcprop -p ttymon/prompt $SMF_FMRI`
79 if [ -n "$val" ]; then
80 prompt=`eval echo $val`
81 exec /usr/lib/saf/ttymon $args -p "`eval echo $prompt` "
82 else
83 exec /usr/lib/saf/ttymon $args