Changeset View
Changeset View
Standalone View
Standalone View
stand/lua/config.lua
Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | if line ~= nil then | ||||
end | end | ||||
if s == nil then | if s == nil then | ||||
return false | return false | ||||
end | end | ||||
end | end | ||||
return true | return true | ||||
end | end | ||||
local function loadModule(mod, silent) | local function loadModule(mod) | ||||
local status = true | local status = true | ||||
local pstatus | local pstatus | ||||
for k, v in pairs(mod) do | for k, v in pairs(mod) do | ||||
if v.load ~= nil and v.load:lower() == "yes" then | if v.load ~= nil and v.load:lower() == "yes" then | ||||
local str = "load " | local str = "load " | ||||
if v.type ~= nil then | if v.type ~= nil then | ||||
str = str .. "-t " .. v.type .. " " | str = str .. "-t " .. v.type .. " " | ||||
end | end | ||||
if v.name ~= nil then | if v.name ~= nil then | ||||
str = str .. v.name | str = str .. v.name | ||||
else | else | ||||
str = str .. k | str = str .. k | ||||
end | end | ||||
if v.flags ~= nil then | if v.flags ~= nil then | ||||
str = str .. " " .. v.flags | str = str .. " " .. v.flags | ||||
end | end | ||||
if v.before ~= nil then | if v.before ~= nil then | ||||
pstatus = cli_execute_unparsed(v.before) == 0 | pstatus = cli_execute_unparsed(v.before) == 0 | ||||
if not pstatus and not silent then | if not pstatus then | ||||
print(MSG_FAILEXBEF:format(v.before, k)) | print(MSG_FAILEXBEF:format(v.before, k)) | ||||
end | end | ||||
status = status and pstatus | status = status and pstatus | ||||
end | end | ||||
if cli_execute_unparsed(str) ~= 0 then | if cli_execute_unparsed(str) ~= 0 then | ||||
if not silent then | |||||
print(MSG_FAILEXMOD:format(str)) | print(MSG_FAILEXMOD:format(str)) | ||||
end | |||||
if v.error ~= nil then | if v.error ~= nil then | ||||
cli_execute_unparsed(v.error) | cli_execute_unparsed(v.error) | ||||
end | end | ||||
status = false | status = false | ||||
end | end | ||||
if v.after ~= nil then | if v.after ~= nil then | ||||
pstatus = cli_execute_unparsed(v.after) == 0 | pstatus = cli_execute_unparsed(v.after) == 0 | ||||
if not pstatus and not silent then | if not pstatus then | ||||
print(MSG_FAILEXAF:format(v.after, k)) | print(MSG_FAILEXAF:format(v.after, k)) | ||||
end | end | ||||
status = status and pstatus | status = status and pstatus | ||||
end | end | ||||
end | end | ||||
end | end | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | function config.loadelf() | ||||
print(MSG_KERNLOADING) | print(MSG_KERNLOADING) | ||||
loaded = config.loadKernel(kernel) | loaded = config.loadKernel(kernel) | ||||
if not loaded then | if not loaded then | ||||
return | return | ||||
end | end | ||||
print(MSG_MODLOADING) | print(MSG_MODLOADING) | ||||
if not loadModule(modules, not config.verbose) then | -- loadModule prints its own error messages | ||||
print(MSG_MODLOADFAIL) | loadModule(modules) | ||||
end | |||||
end | end | ||||
hook.registerType("config.loaded") | hook.registerType("config.loaded") | ||||
hook.registerType("config.reloaded") | hook.registerType("config.reloaded") | ||||
return config | return config |