luci-base: dispatcher.lua: support "absent" fs dependency for menu nodes

The "absent" dependency type requires the given path to not exist on the
local system for the condition to be satisified. This is useful to disable
menu nodes depending on the presence of specific files.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-04-27 13:13:12 +02:00
parent bd739c7abc
commit 2e4b5fb8ff

View file

@ -39,6 +39,10 @@ local function check_fs_depends(spec)
if fs.stat(path, "type") ~= "reg" then if fs.stat(path, "type") ~= "reg" then
return false return false
end end
elseif kind == "absent" then
if fs.stat(path, "type") then
return false
end
end end
end end