diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-04-27 13:13:12 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-04-27 13:19:23 +0200 |
commit | 2e4b5fb8ff2fb3bfd1400bf7cbf721057f02fab9 (patch) | |
tree | 9b07b08d8094f6c938a463f2999cb451053aaf0d /modules/luci-base | |
parent | bd739c7abc1f11de4733d3cce3359ff0d14d233f (diff) |
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>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index e286430765..d27af0755a 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -39,6 +39,10 @@ local function check_fs_depends(spec) if fs.stat(path, "type") ~= "reg" then return false end + elseif kind == "absent" then + if fs.stat(path, "type") then + return false + end end end |