aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-08-25 04:28:02 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-08-25 04:28:02 +0000
commit5dd1b8342c1134b9a621a7959d5060be7543a2f7 (patch)
tree437cad2c51c6c1156cfeb98ccb687310314e04eb /stand
parente67e4c6392dcece04cfdcdf517c4d65a2faf3c11 (diff)
downloadsrc-5dd1b8342c1134b9a621a7959d5060be7543a2f7.tar.gz
src-5dd1b8342c1134b9a621a7959d5060be7543a2f7.zip
lualoader: Fix override of module_path on loader prompt
Earlier changes setup a config.module_path variable that was populated upon reading of loader.conf(5) and used for restoring module_path to pristine condition if multiple kernels are attempted. This broke the ability to override module_path at the loader prompt in case of emergency. Approved by: re (rgrimes)
Notes
Notes: svn path=/head/; revision=338309
Diffstat (limited to 'stand')
-rw-r--r--stand/lua/config.lua20
1 files changed, 17 insertions, 3 deletions
diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index 24ce50bf33b1..b3cce8b4acfc 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -479,6 +479,21 @@ function config.loadKernel(other_kernel)
return nil
end
+ local function getModulePath()
+ local module_path = loader.getenv("module_path")
+ local kernel_path = loader.getenv("kernel_path")
+
+ if kernel_path == nil then
+ return module_path
+ end
+
+ -- Strip the loaded kernel path from module_path. This currently assumes
+ -- that the kernel path will be prepended to the module_path when it's
+ -- found.
+ kernel_path = escapeName(kernel_path .. ';')
+ return module_path:gsub(kernel_path, '')
+ end
+
local function loadBootfile()
local bootfile = loader.getenv("bootfile")
@@ -507,7 +522,7 @@ function config.loadKernel(other_kernel)
else
-- Use our cached module_path, so we don't end up with multiple
-- automatically added kernel paths to our final module_path
- local module_path = config.module_path
+ local module_path = getModulePath()
local res
if other_kernel ~= nil then
@@ -527,6 +542,7 @@ function config.loadKernel(other_kernel)
if module_path ~= nil then
loader.setenv("module_path", v .. ";" ..
module_path)
+ loader.setenv("kernel_path", v)
end
return true
end
@@ -563,8 +579,6 @@ function config.load(file, reloading)
checkNextboot()
- -- Cache the provided module_path at load time for later use
- config.module_path = loader.getenv("module_path")
local verbose = loader.getenv("verbose_loading") or "no"
config.verbose = verbose:lower() == "yes"
if not reloading then