diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2018-10-05 17:07:10 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2018-10-05 17:07:10 +0000 |
| commit | c84dbc532904f2342f06fed592c384fd0c6436f5 (patch) | |
| tree | d28e93a42bbd71dbee68269fd2a31e89ae5ba0c1 /stand/lua/menu.lua | |
| parent | 896571557d2b6013b8fadade0a05b4a802f365e5 (diff) | |
lualoader: Don't draw loader menu with autoboot_delay=-1
This was mostly a cosmetic issue. autoboot_delay=-1 is documented to bypass
the loader menu and immediately execute the boot command, but lualoader
would draw the menu and immediately execute the boot command. No interaction
was possible with the menu.
The fix lifts autoboot_delay processing out of menu.autoboot, which now
takes a delay and does nothing if no delay is specified. This lines up with
my expectations of menu.autoboot's usage from a third party, which may
want more control over the process than the default behavior.
PR: 231610
Approved by: re (gjb)
Notes
svn path=/head/; revision=339200
Diffstat (limited to 'stand/lua/menu.lua')
| -rw-r--r-- | stand/lua/menu.lua | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index 9824c3ebb7e3..cd45238b44a7 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -401,8 +401,22 @@ function menu.process(menudef, keypress) end function menu.run() + local delay = loader.getenv("autoboot_delay") + + if delay ~= nil and delay:lower() == "no" then + delay = nil + else + delay = tonumber(delay) or 10 + end + + if delay == -1 then + core.boot() + return + end + menu.draw(menu.default) - local autoboot_key = menu.autoboot() + + local autoboot_key = menu.autoboot(delay) menu.process(menu.default, autoboot_key) drawn_menu = nil @@ -411,19 +425,15 @@ function menu.run() print("Exiting menu!") end -function menu.autoboot() - local ab = loader.getenv("autoboot_delay") - if ab ~= nil and ab:lower() == "no" then +function menu.autoboot(delay) + -- If we've specified a nil delay, we can do nothing but assume that + -- we aren't supposed to be autobooting. + if delay == nil then return nil - elseif tonumber(ab) == -1 then - core.boot() end - ab = tonumber(ab) or 10 - local x = loader.getenv("loader_menu_timeout_x") or 4 local y = loader.getenv("loader_menu_timeout_y") or 23 - - local endtime = loader.time() + ab + local endtime = loader.time() + delay local time local last repeat |
