git: ffe0cd442311 - stable/13 - lualoader: Add loader_menu_multi_user_prompt config variable

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 22:12:24 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ffe0cd442311819d308ac9837d8b674d9a5c9804

commit ffe0cd442311819d308ac9837d8b674d9a5c9804
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2022-09-02 19:30:40 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:33 +0000

    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()