From: Jo-Philipp Wich Date: Wed, 27 Apr 2022 11:13:12 +0000 (+0200) Subject: luci-base: dispatcher.lua: support "absent" fs dependency for menu nodes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f29452ced0a36d1f4c2dbcb1a7b2e9b0c09e273e;p=project%2Fluci.git 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 (cherry picked from commit 2e4b5fb8ff2fb3bfd1400bf7cbf721057f02fab9) --- 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