From owner-svn-src-head@freebsd.org Fri Oct 5 17:07:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D98910B1879; Fri, 5 Oct 2018 17:07:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B2E2891B7; Fri, 5 Oct 2018 17:07:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D7D518142; Fri, 5 Oct 2018 17:07:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w95H7AiT083987; Fri, 5 Oct 2018 17:07:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w95H7AjK083986; Fri, 5 Oct 2018 17:07:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201810051707.w95H7AjK083986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 5 Oct 2018 17:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339200 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 339200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Oct 2018 17:07:11 -0000 Author: kevans Date: Fri Oct 5 17:07:10 2018 New Revision: 339200 URL: https://svnweb.freebsd.org/changeset/base/339200 Log: 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) Modified: head/stand/lua/menu.lua Modified: head/stand/lua/menu.lua ============================================================================== --- head/stand/lua/menu.lua Fri Oct 5 16:52:21 2018 (r339199) +++ head/stand/lua/menu.lua Fri Oct 5 17:07:10 2018 (r339200) @@ -401,9 +401,23 @@ 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