gluon-status-page: replace nixio with luaposix

This commit is contained in:
Matthias Schiffer 2018-07-13 20:06:18 +02:00
parent 5fc04fb34a
commit 90031ba97a
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -1,6 +1,6 @@
<%- <%-
local fs = require 'nixio.fs'
local ubus = require 'ubus' local ubus = require 'ubus'
local unistd = require 'posix.unistd'
local util = require 'gluon.util' local util = require 'gluon.util'
local translations = {} local translations = {}
@ -42,13 +42,13 @@
local function is_wireless(iface) local function is_wireless(iface)
while true do while true do
local pattern = '/sys/class/net/' .. iface .. '/lower_*' local pattern = '/sys/class/net/' .. iface .. '/lower_*'
local lower = fs.glob(pattern)() local lower = util.glob(pattern)[1]
if not lower then break end if not lower then break end
iface = lower:sub(pattern:len()) iface = lower:sub(pattern:len())
end end
return fs.access('/sys/class/net/' .. iface .. '/wireless') ~= nil return unistd.access('/sys/class/net/' .. iface .. '/wireless') ~= nil
end end
local interfaces = get_interfaces() local interfaces = get_interfaces()
@ -148,7 +148,7 @@
<% <%
for _, iface in ipairs(interfaces) do for _, iface in ipairs(interfaces) do
local wireless = is_wireless(iface) local wireless = is_wireless(iface)
local address = fs.readfile('/sys/class/net/' .. iface .. '/address') local address = util.readfile('/sys/class/net/' .. iface .. '/address')
if address then if address then
%> %>
<h3><%| iface %></h3> <h3><%| iface %></h3>