]]--
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local ip = require "luci.ip"
local math = require "math"
local util = require "luci.util"
return true
elseif val == "0" or val == "no" or val == "off" or val == "false" then
return true
+ elseif val == "" or val == nil then
+ return true
end
return false
if s and not seen[s.ino] then
seen[s.ino] = true
- if s.type == "directory" then
+ if s.type == "dir" then
return true
- elseif s.type == "link" then
+ elseif s.type == "lnk" then
return directory( fs.readlink(val), seen )
end
end
if s and not seen[s.ino] then
seen[s.ino] = true
- if s.type == "regular" then
+ if s.type == "reg" then
return true
- elseif s.type == "link" then
+ elseif s.type == "lnk" then
return file( fs.readlink(val), seen )
end
end
return false
end
+
+function device( val, seen )
+ local s = fs.stat( val )
+ seen = seen or { }
+
+ if s and not seen[s.ino] then
+ seen[s.ino] = true
+ if s.type == "chr" or s.type == "blk" then
+ return true
+ elseif s.type == "lnk" then
+ return device( fs.readlink(val), seen )
+ end
+ end
+
+ return false
+end