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.
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to