luci-base: dispatcher.uc: reintroduce support for 'absent' fs depends
authorJo-Philipp Wich <jo@mein.io>
Tue, 25 Oct 2022 10:50:37 +0000 (12:50 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 25 Oct 2022 10:50:37 +0000 (12:50 +0200)
The ability to require certain paths to be absent for a menu entry to show
up was lost during the ucode conversion.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/ucode/dispatcher.uc

index 7ff8d49c125e3a8826f119b7e5f0aae827c7abd1..50c1a7d0f20cddecf2f0f8970933084657b111e7 100644 (file)
@@ -183,6 +183,10 @@ function check_fs_depends(spec) {
                        if (fstat?.type != 'file')
                                return false;
                }
+               else if (kind == 'absent') {
+                       if (stat(path) != null)
+                               return false;
+               }
        }
 
        return true;