summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-openvpn/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-07-19 00:24:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-07-19 00:24:58 +0000
commit8fcd841aa9af96c8a4a4d3c1a555d2d1ed42332c (patch)
treecf6466b373236442e63742cb4f73b22579940784 /applications/luci-openvpn/luasrc
parent6abba6163290b58cd9ebae98d8459ac38ef52a4b (diff)
convert luci.fs users to nixio.fs api
Diffstat (limited to 'applications/luci-openvpn/luasrc')
-rw-r--r--applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua1
-rw-r--r--applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua1
-rw-r--r--applications/luci-openvpn/luasrc/model/cbi/openvpn.lua22
3 files changed, 8 insertions, 16 deletions
diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua
index 834dceb244..13dfd12978 100644
--- a/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua
+++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua
@@ -12,7 +12,6 @@ You may obtain a copy of the License at
$Id$
]]--
-require("luci.fs")
require("luci.ip")
diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua
index 1d4cc4d7ac..b3e22d4800 100644
--- a/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua
+++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua
@@ -12,7 +12,6 @@ You may obtain a copy of the License at
$Id$
]]--
-require("luci.fs")
require("luci.ip")
require("luci.model.uci")
diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
index 863be2f13c..e71becd06c 100644
--- a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
+++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua
@@ -12,13 +12,9 @@ You may obtain a copy of the License at
$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") )
@@ -74,13 +70,11 @@ s:option( Flag, "enable", translate("openvpn_enable") )
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