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>
(cherry picked from commit 2e4b5fb8ff
)
This commit is contained in:
parent
272611d74e
commit
f29452ced0
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