luci-app-vpnbypass: better service start/stop
authorStan Grishin <stangri@melmac.net>
Fri, 26 Jan 2018 02:30:20 +0000 (18:30 -0800)
committerStan Grishin <stangri@melmac.net>
Fri, 26 Jan 2018 02:34:09 +0000 (18:34 -0800)
Signed-off-by: Stan Grishin <stangri@melmac.net>
applications/luci-app-vpnbypass/Makefile
applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua
applications/luci-app-vpnbypass/po/templates/vpnbypass.pot

index 0ca74ae38aa8fb363ab7533107438238774bc2b0..838840e6b0610fde74ebafdb26643fd35749cd58 100644 (file)
@@ -7,9 +7,10 @@ PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
 
 LUCI_TITLE:=VPN Bypass Web UI
-LUCI_DEPENDS:=+vpnbypass
+LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service.
+LUCI_DEPENDS:=+luci +vpnbypass
 LUCI_PKGARCH:=all
-PKG_RELEASE:=1
+PKG_RELEASE:=3
 
 include ../../luci.mk
 
index bb27b638184ec56a43c6efa0ec1c7687536dc6de..9d2f5f425ca57640661d872136273d467257d6d3 100644 (file)
@@ -4,19 +4,11 @@ m = Map("vpnbypass", translate("VPN Bypass Settings"))
 s = m:section(NamedSection, "config", "vpnbypass")
 
 -- General options
-e = s:option(Flag, "enabled", translate("Enable/start service"))
+e = s:option(Flag, "enabled", translate("Start VPNBypass service"))
 e.rmempty = false
-
-function e.cfgvalue(self, section)
-       return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("vpnbypass") and self.enabled or self.disabled
-end
-
 function e.write(self, section, value)
-       if value == "1" then
-               luci.sys.call("/etc/init.d/vpnbypass enable >/dev/null")
-               luci.sys.call("/etc/init.d/vpnbypass start >/dev/null")
-       else
-               luci.sys.call("/etc/init.d/vpnbypass stop >/dev/null")
+       if value ~= "1" then
+               luci.sys.init.stop("vpnbypass")
        end
        return Flag.write(self, section, value)
 end
index fd92b5e8a85131260aef3cf74e4405615493d1e8..c14c02fe9fec0dcf2bf43952bb914070c27ee207 100644 (file)
@@ -7,9 +7,6 @@ msgstr ""
 msgid "Domains to be accessed directly (outside of the VPN tunnel), see"
 msgstr ""
 
-msgid "Enable/start service"
-msgstr ""
-
 msgid "Local IP Addresses to Bypass"
 msgstr ""
 
@@ -41,6 +38,9 @@ msgstr ""
 msgid "Remote ports to trigger VPN Bypass"
 msgstr ""
 
+msgid "Start VPNBypass service"
+msgstr ""
+
 msgid "VPN Bypass"
 msgstr ""