Home | History | Annotate | Download | only in milestone
      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 2008 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 
     28 cat >console-login.xml <<EOF
     29 <?xml version="1.0"?>
     30 <!--
     31 	Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     32 	Use is subject to license terms.
     33 
     34 	NOTE:  This service manifest is not editable; its contents will
     35 	be overwritten by package or patch operations, including
     36 	operating system upgrade.  Make customizations in a different
     37 	file.
     38 -->
     39 
     40 <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
     41 
     42 <service_bundle type='manifest' name='SUNWcsr:console'>
     43 
     44 <service
     45 	name='system/console-login'
     46 	type='service'
     47 	version='1'>
     48 
     49 	<dependency
     50 		name='fs'
     51 		grouping='require_all'
     52 		restart_on='none'
     53 		type='service'>
     54 		<service_fmri value='svc:/system/filesystem/minimal' />
     55 	</dependency>
     56 
     57 	<dependency
     58 		name='identity'
     59 		grouping='require_all'
     60 		restart_on='none'
     61 		type='service'>
     62 		<service_fmri value='svc:/system/identity:node' />
     63 	</dependency>
     64 
     65 	<dependency
     66 		name='utmpx'
     67 		grouping='require_all'
     68 		restart_on='none'
     69 		type='service'>
     70 		<service_fmri value='svc:/system/utmp:default' />
     71 	</dependency>
     72 
     73 	<!-- Note that console-login should be dependent on any services
     74 	     that may need to use the console. This requirement can be met
     75 	     by establishing a dependency on milestone/sysconfig which,
     76 	     among other things, collects such dependencies.
     77 	-->
     78 	<dependency
     79 		name='sysconfig'
     80 		grouping='require_all'
     81 		restart_on='none'
     82 		type='service'>
     83 		<service_fmri value='svc:/milestone/sysconfig' />
     84 	</dependency>
     85 
     86 	<exec_method
     87 		type='method'
     88 		name='start'
     89 		exec='/lib/svc/method/console-login %i'
     90 		timeout_seconds='0'>
     91                 <method_context>
     92                         <method_credential user='root' group='root' />
     93                 </method_context>
     94         </exec_method>
     95 
     96 	<exec_method
     97 		type='method'
     98 		name='stop'
     99 		exec=':kill -9'
    100 		timeout_seconds='3'>
    101                 <method_context>
    102                         <method_credential user='root' group='root' />
    103                 </method_context>
    104         </exec_method>
    105 
    106 
    107 	<property_group name='startd' type='framework'>
    108 		<propval name='duration' type='astring' value='child' />
    109 		<propval name='ignore_error' type='astring'
    110 			value='core,signal' />
    111 		<propval name='utmpx_prefix' type='astring' value='co' />
    112 	</property_group>
    113 
    114 	<property_group name='general' type='framework'>
    115 		<propval name='action_authorization' type='astring'
    116 			value='solaris.smf.manage.vt' />
    117 		<propval name='value_authorization' type='astring'
    118 			value='solaris.smf.manage.vt' />
    119 	</property_group>
    120 
    121 	<!-- these are passed to ttymon in the method script.
    122 	     note that value_authorization is not passed to ttymon
    123 	     and it's for smf_security(5).
    124 	-->
    125 	<property_group name='ttymon' type='application'>
    126 		<propval name='value_authorization' type='astring'
    127 			value='solaris.smf.value.vt' />
    128 		<propval name='device' type='astring' value='/dev/console' />
    129 		<propval name='label' type='astring' value='console' />
    130 		<propval name='timeout' type='count' value='0' />
    131 		<propval name='nohangup' type='boolean' value='true' />
    132 		<propval name='modules' type='astring'
    133 		    value='ldterm,ttcompat' />
    134 		<propval name='prompt' type='astring'
    135 		   value='\`uname -n\` console login:' />
    136 		<propval name='terminal_type' type='astring'
    137 		     value='' />
    138 	</property_group>
    139 
    140 
    141 <instance name='default' enabled='true'>
    142 </instance>
    143 
    144 EOF
    145 
    146 # Note that this script file is normally parsed during build by sh(1).
    147 # When the parser encounters an EOF token (like the one above), it
    148 # will fork off and pipe all the text after the EOF above to the shell
    149 # for execution.
    150 #
    151 # one system console (/dev/console) plus five virtual consoles
    152 # (/dev/vt/#, # is from 2 to 6).
    153 
    154 for num in 2 3 4 5 6; do
    155 	cat >>console-login.xml <<EOF
    156 
    157 <instance name='vt$num' enabled='false'>
    158 
    159 	<dependency
    160 		name='system-console'
    161 		grouping='require_all'
    162 		restart_on='none'
    163 		type='service'>
    164 		<service_fmri value='svc:/system/console-login:default' />
    165 	</dependency>
    166 
    167 	<dependency
    168 		name='vtdaemon'
    169 		grouping='require_all'
    170 		restart_on='none'
    171 		type='service'>
    172 		<service_fmri value='svc:/system/vtdaemon:default' />
    173 	</dependency>
    174 
    175         <!-- these are passed to ttymon in the method script -->
    176         <property_group name='ttymon' type='application'>
    177 		<propval name='value_authorization' type='astring'
    178 			value='solaris.smf.value.vt' />
    179 		<propval name='device' type='astring' value='/dev/vt/$num' />
    180 		<propval name='label' type='astring' value='console' />
    181 		<propval name='timeout' type='count' value='0' />
    182 		<propval name='nohangup' type='boolean' value='true' />
    183 		<propval name='modules' type='astring'
    184 			value='ldterm,ttcompat' />
    185 		<propval name='prompt' type='astring'
    186 			value='\`uname -n\` vt$num login:' />
    187 		<propval name='terminal_type' type='astring'
    188 			value='' />
    189 	</property_group>
    190 
    191 </instance>
    192 
    193 EOF
    194 done
    195 
    196 cat >>console-login.xml <<EOF
    197 
    198 	<stability value='Evolving' />
    199 
    200 	<template>
    201 		<common_name>
    202 			<loctext xml:lang='C'>
    203 Console login
    204 			</loctext>
    205 		</common_name>
    206 		<documentation>
    207 			<manpage title='ttymon' section='1M'
    208 				manpath='/usr/share/man' />
    209 		</documentation>
    210 
    211 		<pg_pattern name='ttymon' type='application' target='this'
    212 		    required='false'>
    213 			<prop_pattern name='device' type='astring'
    214 			    required='false'>
    215 				<description>
    216 					<loctext xml:lang='C'>
    217 The terminal device to be used for the console login prompt.
    218 					</loctext>
    219 				</description>
    220 				<visibility value='readwrite'/>
    221 				<cardinality min='1' max='1'/>
    222 				<values>
    223 					<value name='/dev/console'>
    224 						<description>
    225 							<loctext xml:lang='C'>
    226 The default console device
    227 							</loctext>
    228 						</description>
    229 					</value>
    230 					<value name='/dev/wscons'>
    231 						<description>
    232 							<loctext xml:lang='C'>
    233 The physical workstation console (i.e. keyboard and monitor)
    234 							</loctext>
    235 						</description>
    236 					</value>
    237 					<value name='/dev/term/a'>
    238 						<description>
    239 							<loctext xml:lang='C'>
    240 Serial device A
    241 							</loctext>
    242 						</description>
    243 					</value>
    244 					<value name='/dev/term/b'>
    245 						<description>
    246 							<loctext xml:lang='C'>
    247 Serial device B
    248 							</loctext>
    249 						</description>
    250 					</value>
    251 				</values>
    252 				<choices>
    253 					<include_values type='values'/>
    254 				</choices>
    255 			</prop_pattern>
    256 			<prop_pattern name='label' type='astring'
    257 			    required='false'>
    258 				<common_name>
    259 					<loctext xml:lang='C'>
    260 /etc/ttydefs entry
    261 					</loctext>
    262 				</common_name>
    263 				<description>
    264 					<loctext xml:lang='C'>
    265 The appropriate entry from /etc/ttydefs
    266 					</loctext>
    267 				</description>
    268 				<visibility value='readwrite'/>
    269 				<cardinality min='1' max='1'/>
    270 			</prop_pattern>
    271 			<prop_pattern name='timeout' type='count'
    272 			    required='false'>
    273 				<description>
    274 					<loctext xml:lang='C'>
    275 If no user input is given within the number of seconds defined by this property after the prompt is printed, ttymon should exit.
    276 					</loctext>
    277 				</description>
    278 				<units>
    279 					<loctext xml:lang='C'>
    280 seconds
    281 					</loctext>
    282 				</units>
    283 				<visibility value='readwrite'/>
    284 				<cardinality min='1' max='1'/>
    285 			</prop_pattern>
    286 			<prop_pattern name='nohangup' type='boolean'
    287 			    required='false'>
    288 				<description>
    289 					<loctext xml:lang='C'>
    290 Do not force a hangup on the line by setting the speed to zero before setting the speed to the default or specified speed.
    291 					</loctext>
    292 				</description>
    293 				<visibility value='readwrite'/>
    294 				<cardinality min='1' max='1'/>
    295 			</prop_pattern>
    296 			<prop_pattern name='modules' type='astring'
    297 			    required='false'>
    298 				<common_name>
    299 					<loctext xml:lang='C'>
    300 STREAMS modules
    301 					</loctext>
    302 				</common_name>
    303 				<description>
    304 					<loctext xml:lang='C'>
    305 STREAMS modules to be pushed on the terminal
    306 					</loctext>
    307 				</description>
    308 				<visibility value='readwrite'/>
    309 				<internal_separators>,</internal_separators>
    310 			</prop_pattern>
    311 			<prop_pattern name='prompt' type='astring'
    312 			    required='false'>
    313 				<description>
    314 					<loctext xml:lang='C'>
    315 Prompt to be printed on console
    316 					</loctext>
    317 				</description>
    318 				<visibility value='readwrite'/>
    319 				<cardinality min='1' max='1'/>
    320 			</prop_pattern>
    321 			<prop_pattern name='terminal_type' type='astring'
    322 			    required='false'>
    323 				<description>
    324 					<loctext xml:lang='C'>
    325 Sets the initial value of the TERM environment variable
    326 					</loctext>
    327 				</description>
    328 				<visibility value='readwrite'/>
    329 				<cardinality min='1' max='1'/>
    330 			</prop_pattern>
    331 		</pg_pattern>	 
    332 
    333 	</template>
    334 </service>
    335 
    336 </service_bundle>
    337 EOF
    338