lualoader: unload upon kernel change if a kernel was previously loaded

In the majority of cases, a kernel is not loaded before we hit the menu.
However, if a password is set, we'll trigger autoboot and have loadelf'd
beforehand. We also need to take into account one dropping to the loader
prompt and twiddling with things manually; if they try to toggle through
kernels, we'll assume they mean it.

Reported by:	trasz
MFC after:	 3 days
This commit is contained in:
Kyle Evans 2018-10-24 02:02:37 +00:00
parent 13d640d376
commit e414851f3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339677

View File

@ -312,6 +312,9 @@ menu.welcome = {
#all_choices .. ")"
end,
func = function(_, choice, _)
if loader.getenv("kernelname") ~= nil then
loader.perform("unload")
end
config.selectKernel(choice)
end,
alias = {"k", "K"},