lualoader: Honor boot_* variables at lua init
For non-UEFI systems, boot.config(5) may have -s or -v specified for single-user and verbose boot respectively. These were not being properly taken into account and reflected in the "Boot Options" submenu. When we initialize core.lua, we'll record boot_single and boot_verbose as we do ACPI and consider these the system defaults. Reported by: David Wolfskill <david@catwhisker.org> Approved by: re (kib)
This commit is contained in:
parent
3535cdc43e
commit
1613f09199
@ -34,6 +34,10 @@ local hook = require("hook")
|
|||||||
|
|
||||||
local core = {}
|
local core = {}
|
||||||
|
|
||||||
|
local default_safe_mode = false
|
||||||
|
local default_single_user = false
|
||||||
|
local default_verbose = false
|
||||||
|
|
||||||
local function composeLoaderCmd(cmd_name, argstr)
|
local function composeLoaderCmd(cmd_name, argstr)
|
||||||
if argstr ~= nil then
|
if argstr ~= nil then
|
||||||
cmd_name = cmd_name .. " " .. argstr
|
cmd_name = cmd_name .. " " .. argstr
|
||||||
@ -41,6 +45,26 @@ local function composeLoaderCmd(cmd_name, argstr)
|
|||||||
return cmd_name
|
return cmd_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function recordDefaults()
|
||||||
|
-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386,
|
||||||
|
-- it will generally be set upon execution of the kernel. Because of
|
||||||
|
-- this, we can't (or don't really want to) detect/disable ACPI on !i386
|
||||||
|
-- reliably. Just set it enabled if we detect it and leave well enough
|
||||||
|
-- alone if we don't.
|
||||||
|
local boot_acpi = core.isSystem386() and core.getACPIPresent(false)
|
||||||
|
local boot_single = loader.getenv("boot_single") or "no"
|
||||||
|
local boot_verbose = loader.getenv("boot_verbose") or "no"
|
||||||
|
default_single_user = boot_single:lower() ~= "no"
|
||||||
|
default_verbose = boot_verbose:lower() ~= "no"
|
||||||
|
|
||||||
|
if boot_acpi then
|
||||||
|
core.setACPI(true)
|
||||||
|
end
|
||||||
|
core.setSingleUser(default_single_user)
|
||||||
|
core.setVerbose(default_verbose)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Globals
|
-- Globals
|
||||||
-- try_include will return the loaded module on success, or nil on failure.
|
-- try_include will return the loaded module on success, or nil on failure.
|
||||||
-- A message will also be printed on failure, with one exception: non-verbose
|
-- A message will also be printed on failure, with one exception: non-verbose
|
||||||
@ -268,9 +292,9 @@ end
|
|||||||
|
|
||||||
function core.setDefaults()
|
function core.setDefaults()
|
||||||
core.setACPI(core.getACPIPresent(true))
|
core.setACPI(core.getACPIPresent(true))
|
||||||
core.setSafeMode(false)
|
core.setSafeMode(default_safe_mode)
|
||||||
core.setSingleUser(false)
|
core.setSingleUser(default_single_user)
|
||||||
core.setVerbose(false)
|
core.setVerbose(default_verbose)
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.autoboot(argstr)
|
function core.autoboot(argstr)
|
||||||
@ -367,13 +391,6 @@ function core.popFrontTable(tbl)
|
|||||||
return first_value, new_tbl
|
return first_value, new_tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
-- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will
|
recordDefaults()
|
||||||
-- generally be set upon execution of the kernel. Because of this, we can't (or
|
|
||||||
-- don't really want to) detect/disable ACPI on !i386 reliably. Just set it
|
|
||||||
-- enabled if we detect it and leave well enough alone if we don't.
|
|
||||||
if core.isSystem386() and core.getACPIPresent(false) then
|
|
||||||
core.setACPI(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
hook.register("config.reloaded", core.clearCachedKernels)
|
hook.register("config.reloaded", core.clearCachedKernels)
|
||||||
return core
|
return core
|
||||||
|
Loading…
x
Reference in New Issue
Block a user