summaryrefslogtreecommitdiff
path: root/usr/src/cmd/svc/milestone/make-console-login-xml
blob: 336ba8fe4596e43d00a6ce1df812c67d64e386bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#!/sbin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

cat >console-login.xml <<EOF
<?xml version="1.0"?>
<!--
	Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
	Use is subject to license terms.

	NOTE:  This service manifest is not editable; its contents will
	be overwritten by package or patch operations, including
	operating system upgrade.  Make customizations in a different
	file.
-->

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type='manifest' name='SUNWcsr:console'>

<service
	name='system/console-login'
	type='service'
	version='1'>

	<dependency
		name='fs'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/system/filesystem/minimal' />
	</dependency>

	<dependency
		name='identity'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/system/identity:node' />
	</dependency>

	<dependency
		name='utmpx'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/system/utmp:default' />
	</dependency>

	<!-- Note that console-login should be dependent on any services
	     that may need to use the console. This requirement can be met
	     by establishing a dependency on milestone/sysconfig which,
	     among other things, collects such dependencies.
	-->
	<dependency
		name='sysconfig'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/milestone/sysconfig' />
	</dependency>

	<exec_method
		type='method'
		name='start'
		exec='/lib/svc/method/console-login %i'
		timeout_seconds='0'>
                <method_context>
                        <method_credential user='root' group='root' />
                </method_context>
        </exec_method>

	<exec_method
		type='method'
		name='stop'
		exec=':kill -9'
		timeout_seconds='3'>
                <method_context>
                        <method_credential user='root' group='root' />
                </method_context>
        </exec_method>


	<property_group name='startd' type='framework'>
		<propval name='duration' type='astring' value='child' />
		<propval name='ignore_error' type='astring'
			value='core,signal' />
		<propval name='utmpx_prefix' type='astring' value='co' />
	</property_group>

	<property_group name='general' type='framework'>
		<propval name='action_authorization' type='astring'
			value='solaris.smf.manage.vt' />
		<propval name='value_authorization' type='astring'
			value='solaris.smf.manage.vt' />
	</property_group>

	<!-- these are passed to ttymon in the method script.
	     note that value_authorization is not passed to ttymon
	     and it's for smf_security(7).
	-->
	<property_group name='ttymon' type='application'>
		<propval name='value_authorization' type='astring'
			value='solaris.smf.value.vt' />
		<propval name='device' type='astring' value='/dev/console' />
		<propval name='label' type='astring' value='console' />
		<propval name='timeout' type='count' value='0' />
		<propval name='nohangup' type='boolean' value='true' />
		<propval name='modules' type='astring'
		    value='ldterm,ttcompat' />
		<propval name='prompt' type='astring'
		   value='\`uname -n\` console login:' />
		<propval name='terminal_type' type='astring'
		     value='' />
	</property_group>


<instance name='default' enabled='true'>
</instance>

EOF

# Note that this script file is normally parsed during build by sh(1).
# When the parser encounters an EOF token (like the one above), it
# will fork off and pipe all the text after the EOF above to the shell
# for execution.
#
# one system console (/dev/console) plus five virtual consoles
# (/dev/vt/#, # is from 2 to 6).

for num in 2 3 4 5 6; do
	cat >>console-login.xml <<EOF

<instance name='vt$num' enabled='false'>

	<dependency
		name='system-console'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/system/console-login:default' />
	</dependency>

	<dependency
		name='vtdaemon'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/system/vtdaemon:default' />
	</dependency>

        <!-- these are passed to ttymon in the method script -->
        <property_group name='ttymon' type='application'>
		<propval name='value_authorization' type='astring'
			value='solaris.smf.value.vt' />
		<propval name='device' type='astring' value='/dev/vt/$num' />
		<propval name='label' type='astring' value='console' />
		<propval name='timeout' type='count' value='0' />
		<propval name='nohangup' type='boolean' value='true' />
		<propval name='modules' type='astring'
			value='ldterm,ttcompat' />
		<propval name='prompt' type='astring'
			value='\`uname -n\` vt$num login:' />
		<propval name='terminal_type' type='astring'
			value='' />
	</property_group>

</instance>

EOF
done

cat >>console-login.xml <<EOF

	<stability value='Evolving' />

	<template>
		<common_name>
			<loctext xml:lang='C'>
Console login
			</loctext>
		</common_name>
		<documentation>
			<manpage title='ttymon' section='8'
				manpath='/usr/share/man' />
		</documentation>

		<pg_pattern name='ttymon' type='application' target='this'
		    required='false'>
			<prop_pattern name='device' type='astring'
			    required='false'>
				<description>
					<loctext xml:lang='C'>
The terminal device to be used for the console login prompt.
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
				<values>
					<value name='/dev/console'>
						<description>
							<loctext xml:lang='C'>
The default console device
							</loctext>
						</description>
					</value>
					<value name='/dev/wscons'>
						<description>
							<loctext xml:lang='C'>
The physical workstation console (i.e. keyboard and monitor)
							</loctext>
						</description>
					</value>
					<value name='/dev/term/a'>
						<description>
							<loctext xml:lang='C'>
Serial device A
							</loctext>
						</description>
					</value>
					<value name='/dev/term/b'>
						<description>
							<loctext xml:lang='C'>
Serial device B
							</loctext>
						</description>
					</value>
				</values>
				<choices>
					<include_values type='values'/>
				</choices>
			</prop_pattern>
			<prop_pattern name='label' type='astring'
			    required='false'>
				<common_name>
					<loctext xml:lang='C'>
/etc/ttydefs entry
					</loctext>
				</common_name>
				<description>
					<loctext xml:lang='C'>
The appropriate entry from /etc/ttydefs
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
			</prop_pattern>
			<prop_pattern name='timeout' type='count'
			    required='false'>
				<description>
					<loctext xml:lang='C'>
If no user input is given within the number of seconds defined by this property after the prompt is printed, ttymon should exit.
					</loctext>
				</description>
				<units>
					<loctext xml:lang='C'>
seconds
					</loctext>
				</units>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
			</prop_pattern>
			<prop_pattern name='nohangup' type='boolean'
			    required='false'>
				<description>
					<loctext xml:lang='C'>
Do not force a hangup on the line by setting the speed to zero before setting the speed to the default or specified speed.
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
			</prop_pattern>
			<prop_pattern name='modules' type='astring'
			    required='false'>
				<common_name>
					<loctext xml:lang='C'>
STREAMS modules
					</loctext>
				</common_name>
				<description>
					<loctext xml:lang='C'>
STREAMS modules to be pushed on the terminal
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<internal_separators>,</internal_separators>
			</prop_pattern>
			<prop_pattern name='prompt' type='astring'
			    required='false'>
				<description>
					<loctext xml:lang='C'>
Prompt to be printed on console
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
			</prop_pattern>
			<prop_pattern name='terminal_type' type='astring'
			    required='false'>
				<description>
					<loctext xml:lang='C'>
Sets the initial value of the TERM environment variable
					</loctext>
				</description>
				<visibility value='readwrite'/>
				<cardinality min='1' max='1'/>
			</prop_pattern>
		</pg_pattern>

	</template>
</service>

</service_bundle>
EOF