-local uci = require("uci")
-
-local function is_in_dir(file, dir)
- if file == dir then
- return true
- else
- return file:sub(1, #dir) == dir
- end
-end
-
-local function rm(item)
- local ftype = fs.stat(item,"type")
- if ftype == "reg" then
- return fs.remove(item)
- elseif ftype == "dir" then
- local dir = fs.dir(item)
- for file in dir do
- if not rm(item..'/'..file) then
- return false
- end
- end
- return fs.rmdir(item)
- end
-end
-
-local function chmod(item,mode,recursive)
- local result = fs.chmod(item,mode)
- if result and recursive then
- local dir = fs.dir(item)
- if dir then
- for file in dir do
- local ftype = fs.stat(item..'/'..file,"type")
- if ftype == "dir" then
- result = chmod(item..'/'..file,mode,recursive)
- elseif ftype == "reg" then
- result = chmod(item..'/'..file,string.gsub(mode,"x","-"),false)
- end
- if not result then
- break
- end
- end
- end
- end
- return result
-end