Date: Wed, 24 Oct 2018 03:14:10 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339678 - head/stand/lua Message-ID: <201810240314.w9O3EAAF056700@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Wed Oct 24 03:14:10 2018 New Revision: 339678 URL: https://svnweb.freebsd.org/changeset/base/339678 Log: menu.lua: Abort autoboot sequence on failed command Currently, a timeout in the menu autoboot sequence would effectively do nothing. We would return from the autoboot handling, then begin processing the menu without redrawing it. This change makes the behavior a little more friendly. Returning the user to the menu can't have any good effects, so abort the autoboot sequence and drop to the loader prompt. MFC after: 3 days Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Wed Oct 24 02:02:37 2018 (r339677) +++ head/stand/lua/menu.lua Wed Oct 24 03:14:10 2018 (r339678) @@ -373,7 +373,9 @@ function menu.process(menudef, keypress) break elseif key == core.KEY_ENTER then core.boot() - -- Should not return + -- Should not return. If it does, escape menu handling + -- and drop to loader prompt. + return false end key = string.char(key) @@ -404,6 +406,7 @@ function menu.process(menudef, keypress) end function menu.run() + local autoboot_key local delay = loader.getenv("autoboot_delay") if delay ~= nil and delay:lower() == "no" then @@ -419,8 +422,17 @@ function menu.run() menu.draw(menu.default) - local autoboot_key = menu.autoboot(delay) + if delay ~= nil then + autoboot_key = menu.autoboot(delay) + -- autoboot_key should return the key pressed. It will only + -- return nil if we hit the timeout and executed the timeout + -- command. Bail out. + if autoboot_key == nil then + return + end + end + menu.process(menu.default, autoboot_key) drawn_menu = nil @@ -429,11 +441,6 @@ function menu.run() end 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 - end local x = loader.getenv("loader_menu_timeout_x") or 4 local y = loader.getenv("loader_menu_timeout_y") or 23 local endtime = loader.time() + delay @@ -467,6 +474,7 @@ function menu.autoboot(delay) local cmd = loader.getenv("menu_timeout_command") or "boot" cli_execute_unparsed(cmd) + return nil end -- CLI commands
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810240314.w9O3EAAF056700>