From ffe0cd442311819d308ac9837d8b674d9a5c9804 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 2 Sep 2022 20:30:40 +0100 Subject: [PATCH] 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 9b17aa27406f3716383e71c6687d53599a8f8d8a) --- stand/lua/menu.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index f1a4f07a8d73..400dbf3d469b 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -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()