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:
parent
45b8a190dd
commit
4554e23b37
@ -1,3 +1,4 @@
|
|||||||
|
local unistd = require('posix.unistd')
|
||||||
local util = require 'gluon.util'
|
local util = require 'gluon.util'
|
||||||
local json = require 'jsonc'
|
local json = require 'jsonc'
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
@ -43,7 +44,7 @@ function M.get_default_hood(jhood)
|
|||||||
return nil
|
return nil
|
||||||
end
|
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()
|
function M.direct_vpn()
|
||||||
for outgoing_if in io.popen(string.format("batctl o"), 'r'):lines() do
|
for outgoing_if in io.popen(string.format("batctl o"), 'r'):lines() do
|
||||||
-- escape special chars "[]-"
|
-- escape special chars "[]-"
|
||||||
@ -157,7 +158,7 @@ function M.restart_services()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for proc in ipairs(proc_tbl) do
|
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 ...")
|
print(proc.." restarting ...")
|
||||||
os.execute("/etc/init.d/"..proc.." restart")
|
os.execute("/etc/init.d/"..proc.." restart")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user