Since the introduction of SVN r244048 and [follow-up] r244089, it is now

safe to build upon ``boot_serial?'' functionality to make safer UI choices.
This commit is contained in:
Devin Teske 2013-08-08 22:09:46 +00:00
parent 95f1f8d262
commit 5e82c321f8
8 changed files with 51 additions and 43 deletions

View File

@ -1,6 +1,6 @@
\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
\ Copyright (c) 2006-2011 Devin Teske <dteske@FreeBSD.org>
\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@ -181,8 +181,8 @@ variable logoY
\ beastie Color ``Helper Daemon'' mascot (19 rows x 34 columns)
\ beastiebw B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
\ fbsdbw "FreeBSD" logo in B/W (13 rows x 21 columns)
\ orb Color ``Orb'' mascot (15 rows x 30 columns)
\ orbbw B/W ``Orb'' mascot (15 rows x 32 columns) (default)
\ orb Color ``Orb'' mascot (15 rows x 30 columns) (default)
\ orbbw B/W ``Orb'' mascot (15 rows x 32 columns)
\
\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
\ prevent beastie from being drawn.

View File

@ -1,4 +1,4 @@
\ Copyright (c) 2011 Devin Teske <dteske@FreeBSD.org>
\ Copyright (c) 2011-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@ -26,23 +26,24 @@
marker task-color.4th
\ This function returns TRUE if the `loader_color' environment variable is set
\ to YES, yes, or 1. Otherwise, FALSE is returned.
\ This function returns FALSE if the `loader_color' environment variable is set
\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial).
\
: loader_color? ( -- N )
s" loader_color" getenv dup -1 <> if
2dup s" YES" compare-insensitive 0= if
2dup s" NO" compare-insensitive 0= if
2drop
TRUE exit
FALSE exit
then
2dup s" 1" compare 0= if
2dup s" 0" compare 0= if
2drop
TRUE exit
FALSE exit
then
drop
then
drop
drop FALSE exit
boot_serial? if FALSE else TRUE then
;

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 18, 2011
.Dd August 6, 2013
.Dt COLOR.4TH 8
.Os
.Sh NAME
@ -57,26 +57,26 @@ The commands provided by it are:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic loader_color?
Returns TRUE if the
Returns FALSE if the
.Ic loader_color
environment variable is set to
.Dq YES
.Dq NO
(case-insensitive) or
.Dq 1 .
Otherwise returns FALSE.
.Dq 0 .
Otherwise returns TRUE
.Pq unless booting serial .
.El
.Pp
The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va loader_color
If set to
.Dq YES
.Dq NO
(case-insensitive) or
.Dq 1 ,
.Dq 0 ,
causes
.Ic loader_color?
to return TRUE, indicating to many other modules that color should be used
whenever/wherever possible.
to return FALSE, indicating to many modules that color should not be used.
.El
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact

View File

@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd December 10, 2012
.Dd August 6, 2013
.Dt LOADER.CONF 5
.Os
.Sh NAME
@ -245,8 +245,8 @@ and
.Dq Li none .
.It Va loader_color
If set to
.Dq YES ,
the beastie boot menu will be displayed using ANSI coloring where possible.
.Dq NO ,
the beastie boot menu will be displayed without ANSI coloring.
.El
.Sh FILES
.Bl -tag -width /boot/defaults/loader.conf -compact

View File

@ -1,6 +1,6 @@
\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org>
\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@ -218,7 +218,7 @@ create init_text8 255 allot
\ NOTE: no need to check toggle_stateN since the first time we
\ are called, we will populate init_textN. Further, we don't
\ need to test whether menu_caption[x] (ansi_caption[x] when
\ loader_color=1) is available since we would not have been
\ loader_color?=1) is available since we would not have been
\ called if the caption was NULL.
\ base name of environment variable

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 2011-2012 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 25, 2012
.Dd August 6, 2013
.Dt MENU.4TH 8
.Os
.Sh NAME
@ -83,13 +83,14 @@ The environment variables that effect its behavior are:
.Bl -tag -width bootfile -offset indent
.It Va loader_color
If set to
.Dq Li YES
.Dq Li NO
(case-insensitive) or
.Dq Li 1 ,
causes the menu to be displayed in color wherever possible.
This includes the
use of ANSI bold for numbers appearing to the left of menuitems and the use of
special
.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
@ -148,7 +149,9 @@ When pressed, will cause the execution of
.It Va ansi_caption[x]
If
.Va loader_color
is set, use this caption for menuitem
is set
.Pq enabled by default ,
use this caption for menuitem
.Dq Li x
instead of
.Va menu_caption[x] .
@ -165,7 +168,8 @@ Like
.Va toggled_text[x]
except used when
.Va loader_color
is enabled.
is enabled
.Pq default .
.It Va menu_caption[x][y]
For menuitems where
.Va menu_command[x]
@ -179,7 +183,8 @@ Like
.Va menu_caption[x][y]
except used when
.Va loader_color
is enabled.
is enabled
.Pq default .
.It Va menu_acpi
When set to a number
.Dq Li x

View File

@ -16,7 +16,7 @@ draw-brand \ draw the FreeBSD title (top-left; see `brand.4th')
menu-init \ initialize the menu area (see `menu.4th')
\ Initialize main menu constructs (see `menu.4th')
\ NOTE: To use the `ansi' variants, add `loader_color=1' to loader.conf(5)
\ NOTE: To use `non-ansi' variants, add `loader_color=0' to loader.conf(5)
\
\ MAIN MENU

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 2011 Devin Teske
.\" Copyright (c) 2011-2013 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 19, 2011
.Dd August 6, 2013
.Dt VERSION.4TH 8
.Os
.Sh NAME
@ -84,10 +84,11 @@ Sets the desired ending row position of
Default is 24.
.It Va loader_color
If set to
.Dq Li YES
.Dq Li NO
(case-insensitive) or
.Dq Li 1 ,
causes the version to be printed in ANSI Cyan.
.Dq Li 0 ,
causes the version to be printed without color
.Pq default is ANSI Cyan .
.El
.Sh FILES
.Bl -tag -width /boot/loader.4th -compact
@ -113,6 +114,7 @@ loader_version="loader 1.1"
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
.Xr color.4th 8
.Sh HISTORY
The
.Nm