Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2018 16:35:46 +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: r329586 - head/stand/lua
Message-ID:  <201802191635.w1JGZkbY003547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Mon Feb 19 16:35:46 2018
New Revision: 329586
URL: https://svnweb.freebsd.org/changeset/base/329586

Log:
  stand/lua: Call menu_entries if it's a function
  
  If we've fetched menu.entries and it turns out it's a function, call it to
  get the actual menu entries.
  
  This will be used to swap multi-/single- user boot options if we're booting
  single user by default (boot_single="YES" in loader.conf(5)). It can also be
  used fairly easily for other non-standard situations.

Modified:
  head/stand/lua/drawer.lua

Modified: head/stand/lua/drawer.lua
==============================================================================
--- head/stand/lua/drawer.lua	Mon Feb 19 16:34:23 2018	(r329585)
+++ head/stand/lua/drawer.lua	Mon Feb 19 16:35:46 2018	(r329586)
@@ -167,7 +167,9 @@ function drawer.drawmenu(m)
 	local alias_table = {};
 	local entry_num = 0;
 	local menu_entries = m.entries;
-
+	if (type(menu_entries) == "function") then
+		menu_entries = menu_entries();
+	end
 	for line_num, e in ipairs(menu_entries) do
 		-- Allow menu items to be conditionally visible by specifying
 		-- a visible function.



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