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:
parent
bd739c7abc
commit
2e4b5fb8ff
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue