gluon-hoodselector: util.lua, use taps instead of spaces. Use posix.unistd.access instead of io.open

Signed-off-by: Jan-Tarek Butt <tarek@ring0.de>
This commit is contained in:
Jan-Tarek Butt 2019-02-09 04:50:31 +01:00
parent 45b8a190dd
commit 4554e23b37

View File

@ -1,3 +1,4 @@
local unistd = require('posix.unistd')
local util = require 'gluon.util'
local json = require 'jsonc'
local uci = require('simple-uci').cursor()
@ -43,7 +44,7 @@ function M.get_default_hood(jhood)
return nil
end
-- bool if direct VPN. The detection is realised by searching the fastd network interface inside the originator table
-- Returns true if the node has an established running VPN connection.
function M.direct_vpn()
for outgoing_if in io.popen(string.format("batctl o"), 'r'):lines() do
-- escape special chars "[]-"
@ -157,7 +158,7 @@ function M.restart_services()
}
for proc in ipairs(proc_tbl) do
if io.open("/etc/init.d/"..proc, 'r') ~= nil then
if unistd.access("/etc/init.d/"..proc, "x") == 0 then
print(proc.." restarting ...")
os.execute("/etc/init.d/"..proc.." restart")
end