Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2018 17:33:01 +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: r329734 - head/stand/lua
Message-ID:  <201802211733.w1LHX1Fo094338@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Feb 21 17:33:01 2018
New Revision: 329734
URL: https://svnweb.freebsd.org/changeset/base/329734

Log:
  lualoader: Don't execute menu.autoboot() for every opened menu
  
  Attempt to autoboot when we open the default menu, and only when we open the
  default menu. This alleviates the need for checking menu.already_autoboot,
  because we're not trying to autoboot every time we open a submenu.
  
  I note that escaping to loader prompt and going back to the menu (by running
  require('menu').run() at the loader prompt) will happily work and not
  re-initiate the autoboot sequence since "Escape to loader prompt" disables
  the autoboot_delay.

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==============================================================================
--- head/stand/lua/menu.lua	Wed Feb 21 16:57:03 2018	(r329733)
+++ head/stand/lua/menu.lua	Wed Feb 21 17:33:01 2018	(r329734)
@@ -361,8 +361,10 @@ function menu.run(m)
 	local alias_table = drawer.drawscreen(m)
 
 	-- Might return nil, that's ok
-	local autoboot_key = menu.autoboot()
-
+	local autoboot_key;
+	if m == menu.default then
+		autoboot_key = menu.autoboot()
+	end
 	cont = true
 	while cont do
 		local key = autoboot_key or io.getchar()
@@ -430,11 +432,6 @@ function menu.skip()
 end
 
 function menu.autoboot()
-	if menu.already_autoboot then
-		return nil
-	end
-	menu.already_autoboot = true
-
 	local ab = loader.getenv("autoboot_delay")
 	if ab ~= nil and ab:lower() == "no" then
 		return nil



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802211733.w1LHX1Fo094338>