summaryrefslogtreecommitdiff
path: root/stand/lua/config.lua
diff options
context:
space:
mode:
Diffstat (limited to 'stand/lua/config.lua')
-rw-r--r--stand/lua/config.lua41
1 files changed, 40 insertions, 1 deletions
diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index 6a898ce8cfb56..702543569c412 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -312,7 +312,7 @@ local function loadModule(mod, silent)
for k, v in pairs(mod) do
if v.load ~= nil and v.load:lower() == "yes" then
local module_name = v.name or k
- if blacklist[module_name] ~= nil then
+ if not v.force and blacklist[module_name] ~= nil then
if not silent then
print(MSG_MODBLACKLIST:format(module_name))
end
@@ -682,6 +682,45 @@ function config.loadelf()
return status
end
+function config.enableModule(modname)
+ if modules[modname] == nil then
+ modules[modname] = {}
+ elseif modules[modname].load == "YES" then
+ modules[modname].force = true
+ return true
+ end
+
+ modules[modname].load = "YES"
+ modules[modname].force = true
+ return true
+end
+
+function config.disableModule(modname)
+ if modules[modname] == nil then
+ return false
+ elseif modules[modname].load ~= "YES" then
+ return true
+ end
+
+ modules[modname].load = "NO"
+ modules[modname].force = nil
+ return true
+end
+
+function config.isModuleEnabled(modname)
+ local mod = modules[modname]
+ if not mod or mod.load ~= "YES" then
+ return false
+ end
+
+ if mod.force then
+ return true
+ end
+
+ local blacklist = getBlacklist()
+ return blacklist[modname]
+end
+
hook.registerType("config.loaded")
hook.registerType("config.reloaded")
hook.registerType("kernel.loaded")