summaryrefslogtreecommitdiff
path: root/stand/forth/menu.4th.8
blob: 3673eec74aa70b64d897d3dc769357403343b75b (plain) (blame)
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 6, 2013
.Dt MENU.4TH 8
.Os
.Sh NAME
.Nm menu.4th
.Nd FreeBSD dynamic menu boot module
.Sh DESCRIPTION
The file that goes by the name of
.Nm
is a set of commands designed to display a dynamic menu system managed through
a system of carefully named environment variables.
The commands of
.Nm
by themselves are not enough for most uses.
Please refer to the
examples below for the most common situations, and to
.Xr loader 8
for additional commands.
.Pp
Before using any of the commands provided in
.Nm ,
it must be included
through the command:
.Pp
.Dl include menu.4th
.Pp
This line is present in the default
.Pa /boot/menu.rc
file, so it is not needed (and should not be re-issued) in a normal setup.
.Pp
The commands provided by it are:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic menu-init
Draws the menu bounding box and initializes some internal state variables.
This should be called before any other menu-related functions.
.It Ic menu-display
Displays the menu (configured via the below documented environment variables)
and blocks on keyboard input, awaiting user action.
.It Ic menu-erase
Clears the screen area within the menu bounding box.
.It Ic menu-redraw
Calls
.Ic menu-erase
and then redraws the menu.
.It Ic menu-unset
Unsets the environment variables associated with individual menu items,
clearing the way for a new menu.
.It Ic menu-clear
Calls
.Ic menu-unset
and then
.Ic menu-erase .
.El
.Pp
The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va loader_color
If set to
.Dq Li NO
(case-insensitive) or
.Dq Li 0 ,
causes the menu to be displayed without color.
The default is to use ANSI coloring whenever possible.
If serial boot is enabled, color is disabled by default.
Color features include the use of ANSI bold for numbers appearing to the left
of menuitems and the use of special
.Dq Li ansi
variables described below.
.It Va autoboot_delay
Number of seconds
.Ic menu-display
will wait before executing
.Va menu_timeout_command
.Ic ( boot
by default) unless a key is pressed.
If set to
.Dq Li NO
(case-insensitive)
.Ic menu-display
will wait for user input and never execute
.Ic menu_timeout_command .
If set to
.Dq Li -1 ,
.Ic menu-display
will boot immediately, preventing both interruption of the
.Ic autoboot
process and escaping to the loader prompt.
Default is
.Dq Li 10 .
See
.Xr loader 8
for additional information.
.It Va menu_timeout_command
The command to be executed after
.Va autoboot_delay
seconds if a key is not pressed.
The default is
.Ic boot .
.It Va loader_menu_frame
Sets the desired box style to draw around the boot menu.
Possible values are:
.Dq Li single
.Pq the default ,
.Dq Li double ,
and
.Dq Li none .
.It Va loader_menu_timeout_x
Sets the desired column position of the timeout countdown text.
Default is 4.
.It Va loader_menu_timeout_y
Sets the desired row position of the timeout countdown text.
Default is 23.
.It Va loader_menu_title
The text to display above the menu.
Default is
.Dq Li "Welcome to FreeBSD" .
.It Va loader_menu_title_align
Default is to align
.Ic loader_menu_title
centered above the menu. This can be set to
.Dq Li left
or
.Dq Li right
to instead display the title left-or-right justified
.Pq respectively .
.It Va loader_menu_x
Sets the desired column position of the boot menu.
Default is 5.
.It Va loader_menu_y
Sets the desired row position of the boot menu.
Default is 10.
.It Va menu_caption[x]
The text to be displayed for the numbered menuitem
.Dq Li x .
.It Va menu_command[x]
The command to be executed when the number associated with menuitem
.Dq Li x
is pressed.
See the list of included FICL words below for some ideas.
.It Va menu_keycode[x]
An optional decimal ASCII keycode to be associated with menuitem
.Dq Li x .
When pressed, will cause the execution of
.Va menu_command[x] .
.It Va ansi_caption[x]
If
.Va loader_color
is set
.Pq enabled by default ,
use this caption for menuitem
.Dq Li x
instead of
.Va menu_caption[x] .
.It Va toggled_text[x]
For menuitems where
.Va menu_command[x]
is set to
.Dq Li toggle_menuitem
(or a derivative thereof), the text displayed
will toggle between this and
.Va menu_caption[x] .
.It Va toggled_ansi[x]
Like
.Va toggled_text[x]
except used when
.Va loader_color
is enabled
.Pq default .
.It Va menu_caption[x][y]
For menuitems where
.Va menu_command[x]
is set to
.Dq Li cycle_menuitem
(or a derivative thereof), the text displayed will cycle between this and other
.Va menu_caption[x][y]
entries.
.It Va ansi_caption[x][y]
Like
.Va menu_caption[x][y]
except used when
.Va loader_color
is enabled
.Pq default .
.It Va menu_acpi
When set to a number
.Dq Li x
associated with a given menuitem, that menuitem will only appear when
running on i386-compatible hardware,
.Va hint.acpi.0.rsdp
is set (indicating the presence of hardware ACPI support as detected by
.Xr loader 8 ) ,
and
.Va hint.acpi.0.disabled
is not set.
On non-i386 hardware, menuitems configured after the
.Dq Li menu_acpi
menuitem will use a lower number (to compensate for the missing ACPI menuitem)
but continue to function as expected.
On i386-compatible hardware lacking ACPI support (as detected by
.Xr loader 8 ) ,
subsequent menuitems will retain their associated numbers.
.It Va hint.acpi.0.rsdp
Set automatically by
.Xr loader 8
on i386-compatible hardware when ACPI support is detected at boot time.
Effects the display of the
.Dq Li menu_acpi
menuitem (if configured).
.It Va hint.acpi.0.disabled
Effects the display of the
.Va menu_acpi
menuitem.
If set, the menuitem will display
.Va toggled_text[x]
.Va ( toggled_ansi[x]
if
.Va loader_color
is set), otherwise
.Va menu_caption[x]
.Va ( ansi_caption[x]
if
.Va loader_color
is set).
.It Va menu_options
When set to a number
.Dq Li x ,
a single blank-line and an
.Dq Li Options
header are inserted between
.Va menu_caption[x-1]
and
.Va menu_caption[x]
(if configured).
.It Va menu_reboot
If set, adds a built-in
.Dq Li Reboot
menuitem to the end of the last configured menuitem.
If
.Va menu_options
is configured, the
.Dq Li Reboot
menuitem will be inserted before the
.Dq Options
separator.
.El
.Pp
In addition, it provides the following FICL words:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic arch-i386? ( -- BOOL )
Returns true (-1) on i386 and false (0) otherwise.
.It Ic acpipresent? ( -- BOOL )
Returns true (-1) if ACPI is present and false (0) otherwise.
.It Ic acpienabled? ( -- BOOL )
Returns true (-1) if ACPI is enabled and false (0) otherwise.
.It Ic toggle_menuitem ( N -- N )
Toggles menuitem
.Dq Li N
between
.Va menu_caption[x]
and
.Va toggled_text[x]
(where
.Dq Li N
represents the ASCII decimal value for
.Dq Li x ) .
.It Ic cycle_menuitem ( N -- N )
Cycles menuitem
.Dq Li N
between
.Va menu_caption[x][y]
entries (where
.Va N
represents the ASCII decimal value for
.Va x ) .
.El
.Pp
For all values of
.Dq Li x
above, use any number between 1 through 9. Sorry, double-digits are not
currently supported.
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact
.It Pa /boot/loader
The
.Xr loader 8 .
.It Pa /boot/menu.4th
.Nm
itself.
.It Pa /boot/loader.rc
.Xr loader 8
bootstrapping script.
.El
.Sh EXAMPLES
A simple boot menu:
.Pp
.Bd -literal -offset indent -compact
include /boot/menu.4th
menu-init
set menu_caption[1]="Boot"
set menu_command[1]="boot"
set menu_options=2
set menu_caption[2]="Option: NO"
set toggled_text[2]="Option: YES"
set menu_command[2]="toggle_menuitem"
set menu_timeout_command="boot"
set menu_reboot
menu-display
.Ed
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr beastie.4th 8 ,
.Xr loader 8 ,
.Xr loader.4th 8
.Sh HISTORY
The
.Nm
set of commands first appeared in
.Fx 9.0 .
.Sh AUTHORS
The
.Nm
set of commands was written by
.An -nosplit
.An Devin Teske Aq dteske@FreeBSD.org .