aboutsummaryrefslogtreecommitdiff
path: root/stand/lua/menu.lua
diff options
context:
space:
mode:
Diffstat (limited to 'stand/lua/menu.lua')
-rw-r--r--stand/lua/menu.lua90
1 files changed, 62 insertions, 28 deletions
diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua
index f1a4f07a8d73..fb0645eb46ba 100644
--- a/stand/lua/menu.lua
+++ b/stand/lua/menu.lua
@@ -1,5 +1,5 @@
--
--- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+-- SPDX-License-Identifier: BSD-2-Clause
--
-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
@@ -26,8 +26,6 @@
-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-- SUCH DAMAGE.
--
--- $FreeBSD$
---
local cli = require("cli")
local core = require("core")
@@ -58,6 +56,13 @@ local function bootenvSet(env)
loader.setenv("vfs.root.mountfrom", env)
loader.setenv("currdev", env .. ":")
config.reload()
+ if loader.getenv("kernelname") ~= nil then
+ loader.perform("unload")
+ end
+end
+
+local function multiUserPrompt()
+ return loader.getenv("loader_menu_multi_user_prompt") or "Multi user"
end
-- Module exports
@@ -117,7 +122,7 @@ menu.boot_environments = {
if is_default then
name_color = color.escapefg(color.GREEN)
else
- name_color = color.escapefg(color.BLUE)
+ name_color = color.escapefg(color.CYAN)
end
bootenv_name = bootenv_name .. name_color ..
choice .. color.resetfg()
@@ -171,7 +176,7 @@ menu.boot_options = {
-- acpi
{
entry_type = core.MENU_ENTRY,
- visible = core.isSystem386,
+ visible = core.hasACPI,
name = function()
return OnOff(color.highlight("A") ..
"CPI :", core.acpi)
@@ -250,24 +255,40 @@ menu.welcome = {
},
{
entry_type = core.MENU_SEPARATOR,
- name = "Options:",
+ name = "Kernel:",
},
menu_entries.kernel_options,
+ {
+ entry_type = core.MENU_SEPARATOR,
+ },
+ {
+ entry_type = core.MENU_SEPARATOR,
+ name = "Options:",
+ },
menu_entries.boot_options,
menu_entries.zpool_checkpoints,
menu_entries.boot_envs,
menu_entries.chainload,
menu_entries.vendor,
+ {
+ entry_type = core.MENU_SEPARATOR,
+ },
+ menu_entries.loader_needs_upgrade,
}
end,
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()
@@ -318,22 +339,19 @@ menu.welcome = {
items = core.kernelList,
name = function(idx, choice, all_choices)
if #all_choices == 0 then
- return "Kernel: "
+ return ""
end
- local is_default = (idx == 1)
- local kernel_name = ""
+ local kernel_name
local name_color
- if is_default then
+ if idx == 1 then
name_color = color.escapefg(color.GREEN)
- kernel_name = "default/"
else
- name_color = color.escapefg(color.BLUE)
+ name_color = color.escapefg(color.CYAN)
end
- kernel_name = kernel_name .. name_color ..
- choice .. color.resetfg()
- return color.highlight("K") .. "ernel: " ..
- kernel_name .. " (" .. idx .. " of " ..
+ kernel_name = name_color .. choice ..
+ color.resetfg()
+ return kernel_name .. " (" .. idx .. " of " ..
#all_choices .. ")"
end,
func = function(_, choice, _)
@@ -401,6 +419,15 @@ menu.welcome = {
end,
alias = {"l", "L"},
},
+ loader_needs_upgrade = {
+ entry_type = core.MENU_SEPARATOR,
+ name = function()
+ return color.highlight("Loader needs to be updated")
+ end,
+ visible = function()
+ return core.loaderTooOld()
+ end
+ },
vendor = {
entry_type = core.MENU_ENTRY,
visible = function()
@@ -507,12 +534,14 @@ function menu.run()
drawn_menu = nil
screen.defcursor()
+ -- We explicitly want the newline print adds
print("Exiting menu!")
end
function menu.autoboot(delay)
local x = loader.getenv("loader_menu_timeout_x") or 4
- local y = loader.getenv("loader_menu_timeout_y") or 23
+ local y = loader.getenv("loader_menu_timeout_y") or 24
+ local autoboot_show = loader.getenv("loader_autoboot_show") or "yes"
local endtime = loader.time() + delay
local time
local last
@@ -520,19 +549,24 @@ function menu.autoboot(delay)
time = endtime - loader.time()
if last == nil or last ~= time then
last = time
- screen.setcursor(x, y)
- print("Autoboot in " .. time ..
- " seconds. [Space] to pause ")
- screen.defcursor()
+ if autoboot_show == "yes" then
+ screen.setcursor(x, y)
+ printc("Autoboot in " .. time ..
+ " seconds. [Space] to pause ")
+ screen.defcursor()
+ end
end
if io.ischar() then
local ch = io.getchar()
if ch == core.KEY_ENTER then
break
else
- -- erase autoboot msg
- screen.setcursor(0, y)
- print(string.rep(" ", 80))
+ -- Erase autoboot msg. While real VT100s
+ -- wouldn't scroll when receiving a char with
+ -- the cursor at (79, 24), bad emulators do.
+ -- Avoid the issue by stopping at 79.
+ screen.setcursor(1, y)
+ printc(string.rep(" ", 79))
screen.defcursor()
return ch
end