From 48230b85ac16ea26f3c8883bf6d72884392c8a3c Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 21 Feb 2018 02:35:13 +0000 Subject: [PATCH] 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 --- stand/lua/loader.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stand/lua/loader.lua b/stand/lua/loader.lua index ee7e0bf3b190..4b02e4566db7 100644 --- a/stand/lua/loader.lua +++ b/stand/lua/loader.lua @@ -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