applications/luci-multiwan: use new uci disable option instead of disabling the init script
This commit is contained in:
parent
b22f022f2c
commit
c3426d56b1
2 changed files with 16 additions and 18 deletions
|
@ -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."))
|
translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover."))
|
||||||
|
|
||||||
s = m:section(NamedSection, "config", "multiwan", "")
|
s = m:section(NamedSection, "config", "multiwan", "")
|
||||||
|
|
||||||
e = s:option(Flag, "enabled", translate("Enable"))
|
e = s:option(Flag, "enabled", translate("Enable"))
|
||||||
e.rmempty = false
|
e.rmempty = false
|
||||||
|
e.default = e.enabled
|
||||||
|
|
||||||
function e.write(self, section, value)
|
function e.write(self, section, value)
|
||||||
local cmd = (value == "1") and "enable" or "disable"
|
if value == "0" then
|
||||||
if value ~= "1" then
|
os.execute("/etc/init.d/multiwan stop")
|
||||||
os.execute("/etc/init.d/multiwan stop")
|
else
|
||||||
end
|
os.execute("/etc/init.d/multiwan enable")
|
||||||
os.execute("/etc/init.d/multiwan " .. cmd)
|
end
|
||||||
end
|
Flag.write(self, section, value)
|
||||||
|
|
||||||
function e.cfgvalue(self, section)
|
|
||||||
return (os.execute("/etc/init.d/multiwan enabled") == 0) and "1" or "0"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
s = m:section(TypedSection, "interface", translate("WAN Interfaces"),
|
s = m:section(TypedSection, "interface", translate("WAN Interfaces"),
|
||||||
|
|
|
@ -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."))
|
translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover."))
|
||||||
|
|
||||||
s = m:section(NamedSection, "config", "multiwan", "")
|
s = m:section(NamedSection, "config", "multiwan", "")
|
||||||
|
|
||||||
e = s:option(Flag, "enabled", translate("Enable"))
|
e = s:option(Flag, "enabled", translate("Enable"))
|
||||||
e.rmempty = false
|
e.rmempty = false
|
||||||
|
e.default = "1"
|
||||||
|
|
||||||
function e.write(self, section, value)
|
function e.write(self, section, value)
|
||||||
local cmd = (value == "1") and "enable" or "disable"
|
if value == "0" then
|
||||||
if value ~= "1" then
|
os.execute("/etc/init.d/multiwan stop")
|
||||||
os.execute("/etc/init.d/multiwan stop")
|
else
|
||||||
end
|
os.execute("/etc/init.d/multiwan enable")
|
||||||
os.execute("/etc/init.d/multiwan " .. cmd)
|
end
|
||||||
end
|
Flag.write(self, section, value)
|
||||||
|
|
||||||
function e.cfgvalue(self, section)
|
|
||||||
return (os.execute("/etc/init.d/multiwan enabled") == 0) and "1" or "0"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"),
|
s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"),
|
||||||
|
|
Loading…
Reference in a new issue