function index()
require("luci.i18n")
luci.i18n.loadc("ddns")
- if not luci.fs.access("/etc/config/ddns") then
+ if not nixio.fs.access("/etc/config/ddns") then
return
end
local page = entry({"mini", "network", "ddns"}, cbi("ddns/ddnsmini", {autoapply=true}), luci.i18n.translate("ddns"), 60)
page.i18n = "ddns"
page.dependent = true
-end
\ No newline at end of file
+end
function index()
require("luci.i18n")
luci.i18n.loadc("hd_idle")
- if not luci.fs.access("/etc/config/hd-idle") then
+ if not nixio.fs.access("/etc/config/hd-idle") then
return
end
]]--
-require("luci.fs")
+require("nixio.fs")
m = Map("hd-idle", translate("hd_idle"), translate("hd_idle_desc"))
disk = s:option(Value, "disk", translate("disk"))
disk.rmempty = true
-for _, dev in ipairs(luci.fs.glob("/dev/[sh]d[a-z]")) do
- disk:value(luci.fs.basename(dev))
+for _, dev in nixio.fs.glob("/dev/[sh]d[a-z]") do
+ disk:value(nixio.fs.basename(dev))
end
s:option(Value, "idle_time_interval", translate("idle_time_interval")).default = 10
module("luci.controller.init", package.seeall)
function index()
- if not luci.fs.access("/etc/rc.common") then
+ if not nixio.fs.access("/etc/rc.common") then
return
end
function index()
require("luci.i18n")
luci.i18n.loadc("mmc_over_gpio")
- if not luci.fs.access("/etc/config/mmc_over_gpio") then
+ if not nixio.fs.access("/etc/config/mmc_over_gpio") then
return
end
function index()
require("luci.i18n")
luci.i18n.loadc("ntpc")
- if not luci.fs.access("/etc/config/ntpclient") then
+ if not nixio.fs.access("/etc/config/ntpclient") then
return
end
module("luci.controller.olsr", package.seeall)
function index()
- if not luci.fs.access("/etc/config/olsrd") then
+ if not nixio.fs.access("/etc/config/olsrd") then
return
end
local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
if #rawdata == 0 then
- if luci.fs.access("/proc/net/ipv6_route", "r") then
+ if nixio.fs.access("/proc/net/ipv6_route", "r") then
rawdata = luci.sys.httpget("http://[::1]:2006/"..otable)
if #rawdata == 0 then
return nil
$Id$
]]--
-require("luci.fs")
-require("luci.ip")
-
+local ip = require "luci.ip"
+local fs = require "nixio.fs"
if arg[1] then
mp = Map("olsrd", translate("olsrd_plugins", "OLSR - Plugins"))
local function Cidr2IpMask(val)
if val then
for i = 1, #val do
- local cidr = luci.ip.IPv4(val[i]) or luci.ip.IPv6(val[i])
+ local cidr = ip.IPv4(val[i]) or ip.IPv6(val[i])
if cidr then
val[i] = cidr:network():string() .. " " .. cidr:mask():string()
end
local ip, mask = val[i]:gmatch("([^%s]+)%s+([^%s]+)")()
local cidr
if ip and mask and ip:match(":") then
- cidr = luci.ip.IPv6(ip, mask)
+ cidr = ip.IPv6(ip, mask)
elseif ip and mask then
- cidr = luci.ip.IPv4(ip, mask)
+ cidr = ip.IPv4(ip, mask)
end
if cidr then
)
-- create a loadplugin section for each found plugin
- for k, v in pairs(luci.fs.dir("/usr/lib")) do
+ for v in fs.dir("/usr/lib") do
if v:sub(1, 6) == "olsrd_" then
if not plugins[v] then
mpi.uci:section(
$Id$
]]--
-require("luci.fs")
require("luci.ip")
$Id$
]]--
-require("luci.fs")
require("luci.ip")
require("luci.model.uci")
$Id$
]]--
-require("luci.fs")
-require("luci.ip")
-require("luci.sys")
-require("luci.model.uci")
-
-
-local uci = luci.model.uci.cursor()
+local fs = require "nixio.fs"
+local sys = require "luci.sys"
+local uci = require "luci.model.uci".cursor()
local m = Map("openvpn", translate("openvpn"))
local s = m:section( TypedSection, "openvpn", translate("openvpn_overview"), translate("openvpn_overview_desc") )
local active = s:option( DummyValue, "_active", translate("openvpn_active") )
function active.cfgvalue(self, section)
- if luci.fs.isfile("/var/run/openvpn_%s.pid" % section) then
- local pid = io.lines("/var/run/openvpn_%s.pid" % section)()
- if pid and #pid > 0 and tonumber(pid) ~= nil then
- return (luci.sys.process.signal(pid, 0))
- and translatef("openvpn_active_yes", pid)
- or translate("openvpn_active_no")
- end
+ local pid = fs.readfile("/var/run/openvpn_%s.pid" % section)
+ if pid and #pid > 0 and tonumber(pid) ~= nil then
+ return (sys.process.signal(pid, 0))
+ and translatef("openvpn_active_yes", pid)
+ or translate("openvpn_active_no")
end
return translate("openvpn_active_no")
end
function index()
require("luci.i18n")
luci.i18n.loadc("p910nd")
- if not luci.fs.access("/etc/config/p910nd") then
+ if not nixio.fs.access("/etc/config/p910nd") then
return
end
module("luci.controller.polipo", package.seeall)
function index()
- if not luci.fs.access("/etc/config/polipo") then
+ if not nixio.fs.access("/etc/config/polipo") then
return
end
module("luci.controller.qos", package.seeall)
function index()
- if not luci.fs.access("/etc/config/qos") then
+ if not nixio.fs.access("/etc/config/qos") then
return
end
local page = entry({"mini", "network", "qos"}, cbi("qos/qosmini", {autoapply=true}), "QoS")
page.i18n = "qos"
page.dependent = true
-end
\ No newline at end of file
+end
$Id$
]]--
-require("luci.tools.webadmin")
+
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
m = Map("qos")
s = m:section(TypedSection, "interface", translate("interfaces"))
srch = s:option(Value, "srchost")
srch.rmempty = true
srch:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(srch)
+wa.cbi_add_knownips(srch)
dsth = s:option(Value, "dsthost")
dsth.rmempty = true
dsth:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(dsth)
+wa.cbi_add_knownips(dsth)
l7 = s:option(ListValue, "layer7", translate("service"))
l7.rmempty = true
l7:value("", translate("all"))
-local pats = luci.fs.dir("/etc/l7-protocols")
+local pats = fs.dir("/etc/l7-protocols")
if pats then
- for i,f in ipairs(pats) do
+ for f in pats do
if f:sub(-4) == ".pat" then
l7:value(f:sub(1, #f-4))
end
$Id$
]]--
-require("luci.tools.webadmin")
+
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
m = Map("qos")
s = m:section(NamedSection, "wan", "interface", translate("m_n_inet"))
srch = s:option(Value, "srchost")
srch.rmempty = true
srch:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(srch)
+wa.cbi_add_knownips(srch)
dsth = s:option(Value, "dsthost")
dsth.rmempty = true
dsth:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(dsth)
+wa.cbi_add_knownips(dsth)
l7 = s:option(ListValue, "layer7", translate("service"))
l7.rmempty = true
l7:value("", translate("all"))
-local pats = luci.fs.dir("/etc/l7-protocols")
+local pats = fs.dir("/etc/l7-protocols")
if pats then
- for i,f in ipairs(pats) do
+ for f in pats do
if f:sub(-4) == ".pat" then
l7:value(f:sub(1, #f-4))
end
module("luci.controller.samba", package.seeall)
function index()
- if not luci.fs.access("/etc/config/samba") then
+ if not nixio.fs.access("/etc/config/samba") then
return
end
require("luci.i18n")
local ipt = require "luci.sys.iptparser".IptParser()
local uci = require "luci.model.uci".cursor_state()
local wat = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
local clients = { }
local leasetime = tonumber(uci:get("luci_splash", "general", "leasetime") or 1) * 60 * 60
local leasefile = "/tmp/dhcp.leases"
end
end)
-if luci.fs.access(leasefile) then
+if fs.access(leasefile) then
for l in io.lines(leasefile) do
local time, mac, ip, name = l:match("^(%d+) (%S+) (%S+) (%S+)")
if time and mac and ip then
require("luci.model.uci")
require("luci.util")
require("luci.sys")
-require("luci.fs")
+
+local fs = require "nixio.fs"
Graph = luci.util.class()
-- prepare directory
local dir = def[1]:gsub("/[^/]+$","")
- luci.fs.mkdir( dir, true )
+ fs.mkdirr( dir )
-- construct commandline
local cmdline = "rrdtool graph"
-- check for a whole graph handler
local plugin_def = "luci.statistics.rrdtool.definitions." .. plugin
- local stat, def = luci.util.copcall( require, plugin_def )
+ local stat, def = pcall( require, plugin_def )
if stat and def and type(def.rrdargs) == "function" then
-- check for data type handler
local dtype_def = plugin_def .. "." .. dtype
- local stat, def = luci.util.copcall( require, dtype_def )
+ local stat, def = pcall( require, dtype_def )
if stat and def and type(def.rrdargs) == "function" then
module("luci.statistics.rrdtool.definitions", package.seeall)
require("luci.util")
-require("luci.fs")
Instance = luci.util.class()
<p><%:stat_networkplugins_installed Installed network plugins:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
- <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
+ <% if nixio.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="<%=controller%>/admin/statistics/collectd/network/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
<p><%:stat_outputplugins_installed Installed output plugins:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
- <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
+ <% if nixio.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="<%=controller%>/admin/statistics/collectd/output/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
<p><%:stat_systemplugins_desc System plugins collecting values about system state and ressource usage on the device.:%>
<ul>
<% for plugin, desc in pairs(plugins) do %>
- <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
+ <% if nixio.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
<li><a href="<%=controller%>/admin/statistics/collectd/system/<%=plugin%>"><%=desc%></a></li>
<% end %>
<% end %>
module("luci.controller.tinyproxy", package.seeall)
function index()
- if not luci.fs.access("/etc/config/tinyproxy") then
+ if not nixio.fs.access("/etc/config/tinyproxy") then
return
end
local page = entry({"admin", "services", "tinyproxy"}, cbi("tinyproxy"), "Tinyproxy")
page.dependent = true
page.i18n = "tinyproxy"
-end
\ No newline at end of file
+end
module("luci.controller.upnp", package.seeall)
function index()
- if not luci.fs.access("/etc/config/upnpd") then
+ if not nixio.fs.access("/etc/config/upnpd") then
return
end
function index()
require("luci.i18n")
luci.i18n.loadc("ushare")
- if not luci.fs.access("/etc/config/ushare") then
+ if not nixio.fs.access("/etc/config/ushare") then
return
end
function index()
require("luci.i18n")
luci.i18n.loadc("uvc_streamer")
- if not luci.fs.access("/etc/config/uvc-streamer") then
+ if not nixio.fs.access("/etc/config/uvc-streamer") then
return
end
local util = require("luci.util")
require("luci.http")
require("luci.uvl")
-require("luci.fs")
+
--local event = require "luci.sys.event"
+local fs = require("nixio.fs")
local uci = require("luci.model.uci")
local class = util.class
local instanceof = util.instanceof
-- Loads a CBI map from given file, creating an environment and returns it
function load(cbimap, ...)
- require("luci.fs")
+ local fs = require "nixio.fs"
local i18n = require "luci.i18n"
require("luci.config")
require("luci.util")
local upldir = "/lib/uci/upload/"
local cbidir = luci.util.libpath() .. "/model/cbi/"
- assert(luci.fs.stat(cbimap) or
- luci.fs.stat(cbidir..cbimap..".lua") or
- luci.fs.stat(cbidir..cbimap..".lua.gz"),
+ assert(fs.stat(cbimap) or
+ fs.stat(cbidir..cbimap..".lua") or
+ fs.stat(cbidir..cbimap..".lua.gz"),
"Model not found!")
local func, err = loadfile(cbimap)
function FileUpload.cfgvalue(self, section)
local val = AbstractValue.cfgvalue(self, section)
- if val and luci.fs.access(val) then
+ if val and fs.access(val) then
return val
end
return nil
then
return val
end
- luci.fs.unlink(val)
+ fs.unlink(val)
self.value = nil
end
return nil
function FileUpload.remove(self, section)
local val = AbstractValue.formvalue(self, section)
- if val and luci.fs.access(val) then luci.fs.unlink(val) end
+ if val and fs.access(val) then fs.unlink(val) end
return AbstractValue.remove(self, section)
end
</head>
<body>
<%
- require("luci.fs")
+ require("nixio.fs")
+ require("nixio.util")
require("luci.http")
require("luci.dispatcher")
end
local filepath = table.concat( path, '/' )
- local filestat = luci.fs.stat( filepath )
+ local filestat = nixio.fs.stat( filepath )
local baseurl = luci.dispatcher.build_url('admin', 'filebrowser')
if filestat and filestat.type == "reg" then
filepath = filepath .. '/'
end
- local entries = luci.fs.dir(filepath)
+ local entries = nixio.util.consume((nixio.fs.dir(filepath)))
-%>
<div id="path">
Location:
<div id="listing">
<ul>
<% for _, e in luci.util.vspairs(entries) do
- local stat = luci.fs.stat(filepath..e)
- if e ~= '.' and e ~= '..' and stat and stat.type == 'dir' then
+ local stat = nixio.fs.stat(filepath..e)
+ if stat and stat.type == 'dir' then
-%>
<li class="dir">
<img src="/luci-static/resources/cbi/folder.png" alt="Directory" />
<% end end -%>
<% for _, e in luci.util.vspairs(entries) do
- local stat = luci.fs.stat(filepath..e)
+ local stat = nixio.fs.stat(filepath..e)
if stat and stat.type ~= 'dir' then
-%>
<li class="file">
<%
local t = require("luci.tools.webadmin")
local v = self:cfgvalue(section)
+ v = v and nixio.fs.stat(v)
-%>
<%+cbi/valueheader%>
<% if v then %>
- <%:cbi_upload Uploaded File%> (<%=t.byte_format(luci.fs.stat(v, "size") or 0)%>)
+ <%:cbi_upload Uploaded File%> (<%=t.byte_format(v.size)%>)
<input type="hidden"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
<input class="cbi-input-image" type="image" value="<%:cbi_replace%>" name="cbi.rlf.<%=section .. "." .. self.option%>" alt="<%:cbi_replace%>" title="<%:cbi_replace%>" src="<%=resource%>/cbi/reload.gif" />
<% else %>
--- Returns the absolute path to LuCI base directory.
-- @return String containing the directory path
function libpath()
- return require "luci.fs".dirname(ldebug.__file__)
+ return require "nixio.fs".dirname(ldebug.__file__)
end
nixio.dup(devnull, nixio.stderr)
return true
-end
\ No newline at end of file
+end
local io = require "io"
local os = require "os"
-local nixio = require "nixio"
local table = require "table"
+local nixio = require "nixio"
+local fs = require "nixio.fs"
local luci = {}
luci.util = require "luci.util"
-luci.fs = require "luci.fs"
luci.ip = require "luci.ip"
local tonumber, ipairs, pairs, pcall, type, next =
-- @return String containing the system hostname
function hostname(newname)
if type(newname) == "string" and #newname > 0 then
- luci.fs.writefile( "/proc/sys/kernel/hostname", newname .. "\n" )
+ fs.writefile( "/proc/sys/kernel/hostname", newname )
return newname
else
return nixio.uname().nodename
-- @return String containing the memory used for buffering in kB
-- @return String containing the free memory amount in kB
function sysinfo()
- local cpuinfo = luci.fs.readfile("/proc/cpuinfo")
- local meminfo = luci.fs.readfile("/proc/meminfo")
+ local cpuinfo = fs.readfile("/proc/cpuinfo")
+ local meminfo = fs.readfile("/proc/meminfo")
local system = cpuinfo:match("system typ.-:%s*([^\n]+)")
local model = ""
-- @param bytes Number of bytes for the unique id
-- @return String containing hex encoded id
function uniqueid(bytes)
- local rand = luci.fs.readfile("/dev/urandom", bytes)
+ local rand = fs.readfile("/dev/urandom", bytes)
return rand and nixio.bin.hexlify(rand)
end
-- @return Table with the currently tracked IP connections
function net.conntrack(callback)
local connt = {}
- if luci.fs.access("/proc/net/nf_conntrack", "r") then
+ if fs.access("/proc/net/nf_conntrack", "r") then
for line in io.lines("/proc/net/nf_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
connt[#connt+1] = entry
end
end
- elseif luci.fs.access("/proc/net/ip_conntrack", "r") then
+ elseif fs.access("/proc/net/ip_conntrack", "r") then
for line in io.lines("/proc/net/ip_conntrack") do
line = line:match "^(.-( [^ =]+=).-)%2"
local entry, flags = _parse_mixed_record(line, " +")
-- @return String containing the MAC address or nil if it cannot be found
function net.ip4mac(ip)
local mac = nil
-
- for i, l in ipairs(net.arptable()) do
- if l["IP address"] == ip then
- mac = l["HW address"]
+ net.arptable(function(e)
+ if e["IP address"] == ip then
+ mac = e["HW address"]
end
- end
-
+ end)
return mac
end
-- { "source", "dest", "nexthop", "metric", "refcount", "usecount",
-- "flags", "device" }
function net.routes6(callback)
- if luci.fs.access("/proc/net/ipv6_route", "r") then
+ if fs.access("/proc/net/ipv6_route", "r") then
local routes = { }
for line in io.lines("/proc/net/ipv6_route") do
-- @return Table containing the names of all inistalled init scripts
function init.names()
local names = { }
- for _, name in ipairs(luci.fs.glob(init.dir.."*")) do
- names[#names+1] = luci.fs.basename(name)
+ for name in fs.glob(init.dir.."*") do
+ names[#names+1] = fs.basename(name)
end
return names
end
-- @param name Name of the init script
-- @return Boolean indicating whether init is enabled
function init.enabled(name)
- if luci.fs.access(init.dir..name) then
+ if fs.access(init.dir..name) then
return ( call(init.dir..name.." enabled") == 0 )
end
return false
-- @param name Name of the init script
-- @return Numeric index value
function init.index(name)
- if luci.fs.access(init.dir..name) then
+ if fs.access(init.dir..name) then
return call("source "..init.dir..name.."; exit $START")
end
end
-- @param name Name of the init script
-- @return Boolean indicating success
function init.enable(name)
- if luci.fs.access(init.dir..name) then
+ if fs.access(init.dir..name) then
return ( call(init.dir..name.." enable") == 1 )
end
end
-- @param name Name of the init script
-- @return Boolean indicating success
function init.disable(name)
- if luci.fs.access(init.dir..name) then
+ if fs.access(init.dir..name) then
return ( call(init.dir..name.." disable") == 0 )
end
end
-- @class module
-- @cstyle instance
-local fs = require "luci.fs"
+require "nixio.util"
+
+local fs = require "nixio.fs"
local uci = require "luci.model.uci"
local util = require "luci.util"
local table = require "table"
local bc = "%s/bytecode/%s.lua" %{ self.schemedir, shm }
if not fs.access(bc) then
- local files = fs.glob(self.schemedir .. '/*/' .. shm)
+ local files = nixio.util.consume(fs.glob(self.schemedir .. '/*/' .. shm))
- if files then
+ if #files > 0 then
local ok, err
- for i, file in ipairs( files ) do
+ for file in files do
if not fs.access(file) then
return false, so:error(ERR.SME_READ(so,file))
end
]]--
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local ip = require "luci.ip"
local math = require "math"
local util = require "luci.util"
]]--
local os = require "os"
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local sys = require "luci.sys"
local ERR = require "luci.uvl.errors"
]]--
local io = require "io"
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local uvl = require "luci.uvl"
local util = require "luci.util"
local ltn12 = require "luci.ltn12"
fs.mkdir(self.output)
for i, file in ipairs(self.additionals) do
- fs.copy(self.sourcedir .. file, self.output .. "/" .. file)
+ fs.datacopy(self.sourcedir .. file, self.output .. "/" .. file)
end
template.compiler_mode = "memory"
]]--
--- LuCI web dispatcher.
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local sys = require "luci.sys"
local init = require "luci.init"
local util = require "luci.util"
function createindex_plain(path, suffixes)
local controllers = { }
for _, suffix in ipairs(suffixes) do
- controllers = util.combine(
- controllers,
- luci.fs.glob(path .. "*" .. suffix) or {},
- luci.fs.glob(path .. "*/*" .. suffix) or {}
- )
+ nixio.util.consume((fs.glob(path .. "*" .. suffix)), controllers)
+ nixio.util.consume((fs.glob(path .. "*/*" .. suffix)), controllers)
end
if indexcache then
- local cachedate = fs.mtime(indexcache)
+ local cachedate = fs.stat(indexcache, "mtime")
if cachedate then
local realdate = 0
for _, obj in ipairs(controllers) do
- local omtime = fs.mtime(path .. "/" .. obj)
+ local omtime = fs.stat(path .. "/" .. obj, "mtime")
realdate = (omtime and omtime > realdate) and omtime or realdate
end
--- LuCI session library.
module("luci.sauth", package.seeall)
-require("luci.fs")
require("luci.util")
require("luci.sys")
require("luci.config")
--- Manually clean up expired sessions.
function clean()
local now = os.time()
- local files = luci.fs.dir(sessionpath)
+ local files = fs.dir(sessionpath)
if not files then
return nil
end
- for i, file in pairs(files) do
+ for file in files do
local fname = sessionpath .. "/" .. file
- local stat = luci.fs.stat(fname)
+ local stat = fs.stat(fname)
if stat and stat.type == "reg" and stat.mtime + sessiontime < now then
- luci.fs.unlink(fname)
+ fs.unlink(fname)
end
end
end
if not sane(sessionpath .. "/" .. id) then
return
end
- luci.fs.utime(sessionpath .. "/" .. id)
- return luci.fs.readfile(sessionpath .. "/" .. id)
+ fs.utimes(sessionpath .. "/" .. id)
+ return fs.readfile(sessionpath .. "/" .. id)
end
-- @return Boolean status
function sane(file)
return luci.sys.process.info("uid")
- == luci.fs.stat(file or sessionpath, "uid")
- and luci.fs.stat(file or sessionpath, "modestr")
+ == fs.stat(file or sessionpath, "uid")
+ and fs.stat(file or sessionpath, "modestr")
== (file and "rw-------" or "rwx------")
end
if not id:match("^%w+$") then
error("Session ID is not sane!")
end
- luci.fs.unlink(sessionpath .. "/" .. id)
-end
\ No newline at end of file
+ fs.unlink(sessionpath .. "/" .. id)
+end
]]--
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local sys = require "luci.sys"
local util = require "luci.util"
local table = require "table"
local err
if compiler_mode == "file" then
- local tplmt = fs.mtime(sourcefile) or fs.mtime(sourcefile .. ".htm")
- local commt = fs.mtime(compiledfile)
+ local tplmt = fs.stat(sourcefile, "mtime") or fs.stat(sourcefile .. ".htm", "mtime")
+ local commt = fs.stat(compiledfile, "mtime")
if not fs.mtime(cdir) then
- fs.mkdir(cdir, true)
+ fs.mkdirr(cdir)
fs.chmod(fs.dirname(cdir), 777)
end
assert(tplmt or commt, "No such template: " .. name)
-- Build if there is no compiled file or if compiled file is outdated
- if not commt or (commt and tplmt and commt < tplmt) then
+ if not commt or (commt and tplmt and commt < tplmt) then
local source
source, err = fs.readfile(sourcefile) or fs.readfile(sourcefile .. ".htm")
page.order = 40
page.index = true
- if luci.fs.access("/etc/config/lucittpd") then
+ if nixio.fs.access("/etc/config/lucittpd") then
local page = node("admin", "services", "lucittpd")
page.target = cbi("admin_services/lucittpd")
page.title = "LuCIttpd"
page.order = 10
end
- if luci.fs.access("/etc/config/httpd") then
+ if nixio.fs.access("/etc/config/httpd") then
local page = node("admin", "services", "httpd")
page.target = cbi("admin_services/httpd")
page.title = "Busybox HTTPd"
page.target = cbi("admin_services/dnsmasq")
page.title = "Dnsmasq"
page.order = 30
-end
\ No newline at end of file
+end
entry({"admin", "system", "processes"}, form("admin_system/processes"), i18n("process_head"), 45)
entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab"), 50)
- if luci.fs.isdirectory("/sys/class/leds") then
+ if nixio.fs.access("/sys/class/leds") then
entry({"admin", "system", "leds"}, cbi("admin_system/leds"), i18n("leds", "LEDs"), 60)
end
-- Remove index cache
if changes then
- luci.fs.unlink("/tmp/luci-indexcache")
+ nixio.fs.unlink("/tmp/luci-indexcache")
end
end
local function storage_size()
local size = 0
- if luci.fs.access("/proc/mtd") then
+ if nixio.fs.access("/proc/mtd") then
for l in io.lines("/proc/mtd") do
local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
if n == "linux" then
break
end
end
- elseif luci.fs.access("/proc/partitions") then
+ elseif nixio.fs.access("/proc/partitions") then
for l in io.lines("/proc/partitions") do
local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)')
if b and n and not n:match('[0-9]') then
local file
luci.http.setfilehandler(
function(meta, chunk, eof)
- if not luci.fs.access(tmpfile) and not file and chunk and #chunk > 0 then
+ if not nixio.fs.access(tmpfile) and not file and chunk and #chunk > 0 then
file = io.open(tmpfile, "w")
end
if file and chunk then
-- Determine state
local keep_avail = true
local step = tonumber(luci.http.formvalue("step") or 1)
- local has_image = luci.fs.access(tmpfile)
+ local has_image = nixio.fs.access(tmpfile)
local has_support = image_supported()
- local has_platform = luci.fs.access("/lib/upgrade/platform.sh")
+ local has_platform = nixio.fs.access("/lib/upgrade/platform.sh")
local has_upload = luci.http.formvalue("image")
-- This does the actual flashing which is invoked inside an iframe
-- If there is an image but user has requested step 1
-- or type is not supported, then remove it.
if has_image then
- luci.fs.unlink(tmpfile)
+ nixio.fs.unlink(tmpfile)
end
luci.template.render("admin_system/upgrade", {
luci.template.render("admin_system/upgrade", {
step=2,
checksum=image_checksum(),
- filesize=luci.fs.stat(tmpfile).size,
+ filesize=nixio.fs.stat(tmpfile).size,
flashsize=storage_size(),
keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1")
} )
if files then
kpattern = ""
for k, v in pairs(files) do
- if k:sub(1,1) ~= "." and luci.fs.glob(v) then
+ if k:sub(1,1) ~= "." and nixio.fs.glob(v)() then
kpattern = kpattern .. " " .. v
end
end
m = Map("luci", translate("webui"), translate("a_i_luci1",
"Hier können Eigenschaften und die Funktionalität der Oberfläche angepasst werden."))
+local fs = require "nixio.fs"
+
-- force reload of global luci config namespace to reflect the changes
function m.commit_handler(self)
package.loaded["luci.config"] = nil
for k, v in luci.util.kspairs(luci.config.languages) do
local file = i18ndir .. k:gsub("_", "-")
if k:sub(1, 1) ~= "." and (
- luci.fs.access(file .. ".lua") or
- luci.fs.access(file .. ".lua.gz")
+ fs.access(file .. ".lua") or
+ fs.access(file .. ".lua.gz")
) then
l:value(k, v)
end
$Id$
]]--
-require("luci.sys")
-require("luci.tools.webadmin")
+
+local uci = require "luci.model.uci".cursor()
+local sys = require "luci.sys"
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
m2 = Map("luci_ethers", translate("dhcp_leases"))
local leasefn, leasefp, leases
-luci.model.uci.cursor():foreach("dhcp", "dnsmasq",
+uci:foreach("dhcp", "dnsmasq",
function(section)
leasefn = section.leasefile
end
)
-local leasefp = leasefn and luci.fs.access(leasefn) and io.lines(leasefn)
+local leasefp = leasefn and fs.access(leasefn) and io.lines(leasefn)
if leasefp then
leases = {}
for lease in leasefp do
ltime = v:option(DummyValue, 1, translate("dhcp_timeremain"))
function ltime.cfgvalue(self, ...)
local value = DummyValue.cfgvalue(self, ...)
- return luci.tools.webadmin.date_format(
- os.difftime(tonumber(value), os.time())
- )
+ return wa.date_format(os.difftime(tonumber(value), os.time()))
end
end
mac = s:option(Value, "macaddr", translate("macaddress"))
ip = s:option(Value, "ipaddr", translate("ipaddress"))
-for i, dataset in ipairs(luci.sys.net.arptable()) do
- ip:value(dataset["IP address"])
- mac:value(dataset["HW address"],
- dataset["HW address"] .. " (" .. dataset["IP address"] .. ")")
-end
+sys.net.arptable(function(entry)
+ ip:value(entry["IP address"])
+ mac:value(
+ entry["HW address"],
+ entry["HW address"] .. " (" .. entry["IP address"] .. ")"
+ )
+end)
return m2
$Id$
]]--
-require("luci.tools.webadmin")
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
arg[1] = arg[1] or ""
-local has_3g = luci.fs.mtime("/usr/bin/gcom")
-local has_pptp = luci.fs.mtime("/usr/sbin/pptp")
-local has_pppd = luci.fs.mtime("/usr/sbin/pppd")
-local has_pppoe = luci.fs.glob("/usr/lib/pppd/*/rp-pppoe.so")
-local has_pppoa = luci.fs.glob("/usr/lib/pppd/*/pppoatm.so")
+local has_3g = fs.access("/usr/bin/gcom")
+local has_pptp = fs.access("/usr/sbin/pptp")
+local has_pppd = fs.access("/usr/sbin/pppd")
+local has_pppoe = fs.glob("/usr/lib/pppd/*/rp-pppoe.so")()
+local has_pppoa = fs.glob("/usr/lib/pppd/*/pppoatm.so")()
m = Map("network", translate("interfaces"), translate("a_n_ifaces1"))
end
end
-local zones = luci.tools.webadmin.network_get_zones(arg[1])
+local zones = wa.network_get_zones(arg[1])
if zones then
if #zones == 0 then
m:chain("firewall")
)
function fwzone.write(self, section, value)
- local zone = luci.tools.webadmin.firewall_find_zone(value)
+ local zone = wa.firewall_find_zone(value)
local stat
if not zone then
$Id$
]]--
-require("luci.sys")
-require("luci.tools.webadmin")
+
+local sys = require "luci.sys"
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
local netstate = luci.model.uci.cursor_state():get_all("network")
m = Map("network", translate("interfaces"))
local created
-local netstat = luci.sys.net.deviceinfo()
+local netstat = sys.net.deviceinfo()
s = m:section(TypedSection, "interface", "")
s.addremove = true
zone.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "zones")
function zone.cfgvalue(self, section)
- local zones = luci.tools.webadmin.network_get_zones(section)
- return zones and table.concat(zones, ", ") or "-"
+ return table.concat(wa.network_get_zones(section) or { "-" }, ", ")
end
end
hwaddr = s:option(DummyValue, "_hwaddr")
function hwaddr.cfgvalue(self, section)
local ix = self.map:get(section, "ifname") or ""
- return luci.fs.readfile("/sys/class/net/" .. ix .. "/address")
+ return fs.readfile("/sys/class/net/" .. ix .. "/address")
or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n")
or "n/a"
-
end
ipaddr = s:option(DummyValue, "ipaddr", translate("addresses"))
function ipaddr.cfgvalue(self, section)
- local addr = luci.tools.webadmin.network_get_addresses(section)
- return table.concat(addr, ", ")
+ return table.concat(wa.network_get_addresses(section), ", ")
end
txrx = s:option(DummyValue, "_txrx")
local ix = self.map:get(section, "ifname")
local rx = netstat and netstat[ix] and netstat[ix][1]
- rx = rx and luci.tools.webadmin.byte_format(tonumber(rx)) or "-"
+ rx = rx and wa.byte_format(tonumber(rx)) or "-"
local tx = netstat and netstat[ix] and netstat[ix][9]
- tx = tx and luci.tools.webadmin.byte_format(tonumber(tx)) or "-"
+ tx = tx and wa.byte_format(tonumber(tx)) or "-"
return string.format("%s / %s", tx, rx)
end
$Id$
]]--
-require("luci.tools.webadmin")
+
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
arg[1] = arg[1] or ""
m = Map("wireless", translate("networks"), translate("a_w_networks1"))
network.rmempty = true
network:value("")
network.combobox_manual = translate("a_w_netmanual")
-luci.tools.webadmin.cbi_add_networks(network)
+wa.cbi_add_networks(network)
function network.write(self, section, value)
if not m.uci:get("network", value) then
-------------------- MAC80211 Interface ----------------------
if hwtype == "mac80211" then
- if luci.fs.mtime("/usr/sbin/iw") then
+ if fs.access("/usr/sbin/iw") then
mode:value("mesh", "802.11s")
end
encr:value("wep", "WEP")
if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
- local supplicant = luci.fs.mtime("/usr/sbin/wpa_supplicant")
- local hostapd = luci.fs.mtime("/usr/sbin/hostapd")
+ local supplicant = fs.access("/usr/sbin/wpa_supplicant")
+ local hostapd = fs.access("/usr/sbin/hostapd")
if hostapd and supplicant then
encr:value("psk", "WPA-PSK")
$Id$
]]--
+
+local fs = require "nixio.fs"
local cronfile = "/etc/crontabs/root"
f = SimpleForm("crontab", translate("a_s_crontab"), translate("a_s_crontab1"))
t.rmempty = true
t.rows = 10
function t.cfgvalue()
- return luci.fs.readfile(cronfile) or ""
+ return fs.readfile(cronfile) or ""
end
function f.handle(self, state, data)
if state == FORM_VALID then
if data.crons then
- luci.fs.writefile(cronfile, data.crons:gsub("\r\n", "\n"))
+ fs.writefile(cronfile, data.crons:gsub("\r\n", "\n"))
end
end
return true
]]--
require("luci.tools.webadmin")
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
+local util = require "nixio.util"
+
local devices = {}
-luci.util.update(devices, fs.glob("/dev/sd*") or {})
-luci.util.update(devices, fs.glob("/dev/hd*") or {})
-luci.util.update(devices, fs.glob("/dev/scd*") or {})
-luci.util.update(devices, fs.glob("/dev/mmc*") or {})
+util.consume((fs.glob("/dev/sd*")), devices)
+util.consume((fs.glob("/dev/hd*")), devices)
+util.consume((fs.glob("/dev/scd*")), devices)
+util.consume((fs.glob("/dev/mmc*")), devices)
local size = {}
for i, dev in ipairs(devices) do
- local s = tonumber((luci.fs.readfile("/sys/class/block/%s/size" % dev:sub(6))))
+ local s = tonumber((fs.readfile("/sys/class/block/%s/size" % dev:sub(6))))
size[dev] = s and math.floor(s / 2048)
end
t = f:field(TextValue, "lines")
t.rows = 10
function t.cfgvalue()
- return luci.fs.readfile(ipkgfile) or ""
+ return nixio.fs.readfile(ipkgfile) or ""
end
function t.write(self, section, data)
- return luci.fs.writefile(ipkgfile, data:gsub("\r\n", "\n"))
+ return nixio.fs.writefile(ipkgfile, data:gsub("\r\n", "\n"))
end
f:append(Template("admin_system/ipkg"))
local sysfs_path = "/sys/class/leds/"
local leds = {}
-if luci.fs.access(sysfs_path) then
- for k, v in pairs(luci.fs.dir(sysfs_path)) do
- if v ~= "." and v ~= ".." then
- table.insert(leds, v)
- end
- end
+local fs = require "nixio.fs"
+local util = require "nixio.util"
+
+if fs.access(sysfs_path) then
+ leds = util.consume((fs.dir(sysfs_path)))
end
if #leds == 0 then
trigger = s:option(ListValue, "trigger")
-local triggers = luci.fs.readfile(sysfs_path .. leds[1] .. "/trigger")
+local triggers = fs.readfile(sysfs_path .. leds[1] .. "/trigger")
for t in triggers:gmatch("[%w-]+") do
trigger:value(t, translate("system_led_trigger_" .. t:gsub("-", "")))
end
mode:value("tx", translate("system_led_mode_tx"))
mode:value("rx", translate("system_led_mode_rx"))
-return m
\ No newline at end of file
+return m
t.rmempty = true
t.rows = 10
function t.cfgvalue()
- return luci.fs.readfile(keyfile) or ""
+ return nixio.fs.readfile(keyfile) or ""
end
function f.handle(self, state, data)
if state == FORM_VALID then
if data.keys then
- luci.fs.writefile(keyfile, data.keys:gsub("\r\n", "\n"))
+ nixio.fs.writefile(keyfile, data.keys:gsub("\r\n", "\n"))
end
end
return true
<%-
- require "luci.tools.webadmin"
-
- local wba = luci.tools.webadmin
- local uci = luci.model.uci.cursor_state()
+ local sys = require "luci.sys"
+ local wba = require "luci.tools.webadmin"
+ local uci = require "luci.model.uci".cursor_state()
+ local fs = require "nixio.fs"
local bridge_ifs = { }
local single_ifs = { }
local wifi_ifs = { }
- local devinfo = luci.sys.net.deviceinfo()
+ local devinfo = sys.net.deviceinfo()
uci:foreach("network", "interface",
function(s)
function get_switch_driver(i)
local n, d = i:match("([a-z]+)(%d+)%.%d+$")
- local hw = luci.fs.readfile("/proc/switch/%s%s/driver" %{ n, d })
- or luci.fs.readfile("/proc/switch/%s/driver" % d )
+ local hw = fs.readfile("/proc/switch/%s%s/driver" %{ n, d })
+ or fs.readfile("/proc/switch/%s/driver" % d )
return hw and hw:match("%S+")
end
<%-
require "bit"
- require "luci.fs"
require "luci.sys"
require "luci.tools.webadmin"
+ require "nixio.fs"
local style = true
-%>
</fieldset>
<br />
- <% if luci.fs.access("/proc/net/ipv6_route") then style = true %>
+ <% if fs.access("/proc/net/ipv6_route") then style = true %>
<fieldset class="cbi-section" id="cbi-table-table">
<legend><%:a_n_routes_kernel6%></legend>
local function storage_size()
local size = 0
- if luci.fs.access("/proc/mtd") then
+ if nixio.fs.access("/proc/mtd") then
for l in io.lines("/proc/mtd") do
local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
if n == "linux" then
break
end
end
- elseif luci.fs.access("/proc/partitions") then
+ elseif nixio.fs.access("/proc/partitions") then
for l in io.lines("/proc/partitions") do
local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)')
if b and n and not n:match('[0-9]') then
local file
luci.http.setfilehandler(
function(meta, chunk, eof)
- if not luci.fs.access(tmpfile) and not file and chunk and #chunk > 0 then
+ if not nixio.fs.access(tmpfile) and not file and chunk and #chunk > 0 then
file = io.open(tmpfile, "w")
end
if file and chunk then
-- Determine state
local keep_avail = true
local step = tonumber(luci.http.formvalue("step") or 1)
- local has_image = luci.fs.access(tmpfile)
+ local has_image = nixio.fs.access(tmpfile)
local has_support = image_supported()
- local has_platform = luci.fs.access("/lib/upgrade/platform.sh")
+ local has_platform = nixio.fs.access("/lib/upgrade/platform.sh")
local has_upload = luci.http.formvalue("image")
-- This does the actual flashing which is invoked inside an iframe
-- If there is an image but user has requested step 1
-- or type is not supported, then remove it.
if has_image then
- luci.fs.unlink(tmpfile)
+ nixio.fs.unlink(tmpfile)
end
luci.template.render("admin_system/upgrade", {
luci.template.render("admin_system/upgrade", {
step=2,
checksum=image_checksum(),
- filesize=luci.fs.stat(tmpfile).size,
+ filesize=nixio.fs.stat(tmpfile).size,
flashsize=storage_size(),
keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1")
} )
if files then
kpattern = ""
for k, v in pairs(files) do
- if k:sub(1,1) ~= "." and luci.fs.glob(v) then
+ if k:sub(1,1) ~= "." and nixio.fs.glob(v)() then
kpattern = kpattern .. " " .. v
end
end
$Id$
]]--
-require("luci.model.uci")
-require("luci.sys")
-require("luci.tools.webadmin")
+
+local uci = require "luci.model.uci".cursor()
+local sys = require "luci.sys"
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
m = Map("dhcp", "DHCP")
m2 = Map("luci_ethers", translate("dhcp_leases"))
local leasefn, leasefp, leases
-luci.model.uci.cursor():foreach("dhcp", "dnsmasq",
+uci:foreach("dhcp", "dnsmasq",
function(section)
leasefn = section.leasefile
end
)
-local leasefp = leasefn and luci.fs.access(leasefn) and io.lines(leasefn)
+local leasefp = leasefn and fs.access(leasefn) and io.lines(leasefn)
if leasefp then
leases = {}
for lease in leasefp do
ltime = v:option(DummyValue, 1, translate("dhcp_timeremain"))
function ltime.cfgvalue(self, ...)
local value = DummyValue.cfgvalue(self, ...)
- return luci.tools.webadmin.date_format(
- os.difftime(tonumber(value), os.time())
- )
+ return wa.date_format(os.difftime(tonumber(value), os.time()))
end
end
mac = s:option(Value, "macaddr", translate("macaddress"))
ip = s:option(Value, "ipaddr", translate("ipaddress"))
-for i, dataset in ipairs(luci.sys.net.arptable()) do
- ip:value(dataset["IP address"])
- mac:value(dataset["HW address"],
- dataset["HW address"] .. " (" .. dataset["IP address"] .. ")")
-end
-
-return m, m2
\ No newline at end of file
+sys.net.arptable(function(entry)
+ ip:value(entry["IP address"])
+ mac:value(
+ entry["HW address"],
+ entry["HW address"] .. " (" .. entry["IP address"] .. ")"
+ )
+end)
+
+return m, m2
$Id$
]]--
-require("luci.config")
+
+require "luci.config"
+local fs = require "nixio.fs"
+
m = Map("luci", translate("webui"), translate("a_i_luci1"))
-- force reload of global luci config namespace to reflect the changes
function m.commit_handler(self)
package.loaded["luci.config"] = nil
- require("luci.config")
+ require "luci.config"
end
for k, v in luci.util.kspairs(luci.config.languages) do
local file = i18ndir .. k:gsub("_", "-")
if k:sub(1, 1) ~= "." and (
- luci.fs.access(file .. ".lua") or
- luci.fs.access(file .. ".lua.gz")
+ fs.access(file .. ".lua") or
+ fs.access(file .. ".lua.gz")
) then
l:value(k, v)
end
$Id$
]]--
-require("luci.tools.webadmin")
-require("luci.sys")
-require("luci.fs")
+local wa = require "luci.tools.webadmin"
+local sys = require "luci.sys"
+local fs = require "nixio.fs"
-local has_pptp = luci.fs.mtime("/usr/sbin/pptp")
-local has_pppoe = luci.fs.glob("/usr/lib/pppd/*/rp-pppoe.so")
+local has_pptp = fs.access("/usr/sbin/pptp")
+local has_pppoe = fs.glob("/usr/lib/pppd/*/rp-pppoe.so")()
local network = luci.model.uci.cursor_state():get_all("network")
-local netstat = luci.sys.net.deviceinfo()
+local netstat = sys.net.deviceinfo()
local ifaces = {}
for k, v in pairs(network) do
translate("network_interface_hwaddr"), translate("network_interface_hwaddr_desc"))
function hwaddr.cfgvalue(self, section)
local ix = self.map:get(section, "ifname") or ""
- return luci.fs.readfile("/sys/class/net/" .. ix .. "/address")
+ return fs.readfile("/sys/class/net/" .. ix .. "/address")
or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n")
or "n/a"
end
local ix = self.map:get(section, "ifname")
local rx = netstat and netstat[ix] and netstat[ix][1]
- rx = rx and luci.tools.webadmin.byte_format(tonumber(rx)) or "-"
+ rx = rx and wa.byte_format(tonumber(rx)) or "-"
local tx = netstat and netstat[ix] and netstat[ix][9]
- tx = tx and luci.tools.webadmin.byte_format(tonumber(tx)) or "-"
+ tx = tx and wa.byte_format(tonumber(tx)) or "-"
return string.format("%s / %s", tx, rx)
end
-- Allow user to set MSS correction here if the UCI firewall is installed
-- This cures some cancer for providers with pre-war routers
-if luci.fs.access("/etc/config/firewall") then
+if fs.access("/etc/config/firewall") then
mssfix = s:option(Flag, "_mssfix",
translate("m_n_mssfix"), translate("m_n_mssfix_desc"))
mssfix.rmempty = false
-- Data init --
-local uci = luci.model.uci.cursor()
+local fs = require "nixio.fs"
+local sys = require "luci.sys"
+local uci = require "luci.model.uci".cursor()
+
if not uci:get("network", "wan") then
uci:section("network", "interface", "wan", {proto="none", ifname=" "})
uci:save("network")
local wlcursor = luci.model.uci.cursor_state()
local wireless = wlcursor:get_all("wireless")
-local wifidata = luci.sys.wifi.getiwconfig()
+local wifidata = sys.wifi.getiwconfig()
local wifidevs = {}
local ifaces = {}
m.autoapply = false
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
- luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname))
+ luci.util.update(t2.data, sys.wifi.iwscan(ifname))
end
t2._render = t2.render
encr:value("wep", "WEP")
if hwtype == "atheros" or hwtype == "mac80211" then
- local supplicant = luci.fs.mtime("/usr/sbin/wpa_supplicant")
- local hostapd = luci.fs.mtime("/usr/sbin/hostapd")
+ local supplicant = fs.access("/usr/sbin/wpa_supplicant")
+ local hostapd = fs.access("/usr/sbin/hostapd")
if hostapd and supplicant then
encr:value("psk", "WPA-PSK")
assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30)
- if luci.fs.access("/etc/config/luci_statistics") then
+ if nixio.fs.access("/etc/config/luci_statistics") then
assign({"freifunk", "graph"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40)
end
local rawdata = sys.httpget("http://127.0.0.1:2006/")
if #rawdata == 0 then
- if luci.fs.access("/proc/net/ipv6_route", "r") then
+ if nixio.fs.access("/proc/net/ipv6_route", "r") then
rawdata = sys.httpget("http://[::1]:2006/")
if #rawdata == 0 then
return nil
function rpc_fs()
local util = require "luci.util"
local io = require "io"
- local fs2 = util.clone(require "luci.fs")
+ local fs2 = util.clone(require "nixio.fs")
local jsonrpc = require "luci.jsonrpc"
local http = require "luci.http"
local ltn12 = require "luci.ltn12"