lualoader: Add loader_menu_multi_user_prompt config variable

This allows the "Multi user" in "[B]oot Multi user" to be substituted
with another string, for example with "Installer" in installer media.
Note that this is lua-only at the moment, since loader.4th's menu.rc
defines the alternate name as Boot [M]ulti User, unlike lualoader which
leaves it as [B]oot Multi user. Ideally loader.4th would adopt the newer
and simpler lualoader behaviour and then it could gain support for this
option, but loader.4th is on the way out and isn't used by any official
installer media so this is not a significant concern.

Reviewed by:	kevans, rpokala
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36418

(cherry picked from commit 9b17aa2740)
This commit is contained in:
Jessica Clarke 2022-09-02 20:30:40 +01:00 committed by Warner Losh
parent 09932da03e
commit ffe0cd4423

View file

@ -60,6 +60,10 @@ local function bootenvSet(env)
config.reload()
end
local function multiUserPrompt()
return loader.getenv("loader_menu_multi_user_prompt") or "Multi user"
end
-- Module exports
menu.handlers = {
-- Menu handlers take the current menu and selected entry as parameters,
@ -263,11 +267,16 @@ menu.welcome = {
all_entries = {
multi_user = {
entry_type = core.MENU_ENTRY,
name = color.highlight("B") .. "oot Multi user " ..
color.highlight("[Enter]"),
name = function()
return color.highlight("B") .. "oot " ..
multiUserPrompt() .. " " ..
color.highlight("[Enter]")
end,
-- Not a standard menu entry function!
alternate_name = color.highlight("B") ..
"oot Multi user",
alternate_name = function()
return color.highlight("B") .. "oot " ..
multiUserPrompt()
end,
func = function()
core.setSingleUser(false)
core.boot()