lualoader: Bring in local.lua module if it exists

Provide a way for out-of-tree users of lualoader to patch into the loader
system without having to modify our distributed scripts.

Do note that we can't really offer any API compatibility guarantees at this
time due to the evolving nature of lualoader right now.

This still has some utility as local modules may add commands at the loader
prompt without relying heavily on lualoader features- this specific
functionality is less likely to change without more careful consideration.

Reviewed by:	cem (earlier version)
Differential Revision:	https://reviews.freebsd.org/D14439
This commit is contained in:
Kyle Evans 2018-02-21 02:35:13 +00:00
parent 73c9b6d523
commit 48230b85ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329692

View File

@ -30,6 +30,13 @@
local config = require("config")
local menu = require("menu")
local password = require("password")
local local_module
local result, errstr, errnoval = lfs.attributes("/boot/lua/local.lua")
-- Effectively discard any errors; we'll just act if it succeeds.
if result ~= nil then
local_module = require("local")
end
-- Declares a global function cli_execute that attempts to dispatch the
-- arguments passed as a lua function. This gives lua a chance to intercept