diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-03-07 13:06:17 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-03-07 13:06:17 +0000 |
commit | c3426d56b1551fd8233a5cd642db2009801b0ab5 (patch) | |
tree | 7df8722ed17c14adea3656bc00fb3b540923108f | |
parent | b22f022f2c3652a5af3c1ef843a9b06eba851404 (diff) |
applications/luci-multiwan: use new uci disable option instead of disabling the init script
-rw-r--r-- | applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua | 17 | ||||
-rw-r--r-- | applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua | 17 |
2 files changed, 16 insertions, 18 deletions
diff --git a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua index 96718f7cf..586b6307d 100644 --- a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua +++ b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua @@ -4,19 +4,18 @@ m = Map("multiwan", translate("Multi-WAN"), translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover.")) s = m:section(NamedSection, "config", "multiwan", "") + e = s:option(Flag, "enabled", translate("Enable")) e.rmempty = false +e.default = e.enabled function e.write(self, section, value) - local cmd = (value == "1") and "enable" or "disable" - if value ~= "1" then - os.execute("/etc/init.d/multiwan stop") - end - os.execute("/etc/init.d/multiwan " .. cmd) -end - -function e.cfgvalue(self, section) - return (os.execute("/etc/init.d/multiwan enabled") == 0) and "1" or "0" + if value == "0" then + os.execute("/etc/init.d/multiwan stop") + else + os.execute("/etc/init.d/multiwan enable") + end + Flag.write(self, section, value) end s = m:section(TypedSection, "interface", translate("WAN Interfaces"), diff --git a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua index e14dc0a9f..d38974549 100644 --- a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua +++ b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua @@ -4,19 +4,18 @@ m = Map("multiwan", translate("Multi-WAN"), translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover.")) s = m:section(NamedSection, "config", "multiwan", "") + e = s:option(Flag, "enabled", translate("Enable")) e.rmempty = false +e.default = "1" function e.write(self, section, value) - local cmd = (value == "1") and "enable" or "disable" - if value ~= "1" then - os.execute("/etc/init.d/multiwan stop") - end - os.execute("/etc/init.d/multiwan " .. cmd) -end - -function e.cfgvalue(self, section) - return (os.execute("/etc/init.d/multiwan enabled") == 0) and "1" or "0" + if value == "0" then + os.execute("/etc/init.d/multiwan stop") + else + os.execute("/etc/init.d/multiwan enable") + end + Flag.write(self, section, value) end s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"), |