+-- Interface Wizard
+
+if uplink == "" then
+ ds = m:section(NamedSection, "global", "travelmate", translate("Interface Wizard"))
+ o = ds:option(Value, "trm_iface", translate("Create Uplink interface"),
+ translate("Create a new wireless wan uplink interface, configure it to use dhcp and ")
+ .. translate("add it to the wan zone of the firewall.<br />")
+ .. translate("This step has only to be done once."))
+ o.datatype = "and(uciname,rangelength(3,15))"
+ o.default = trmiface
+ o.rmempty = false
+
+ function o.validate(self, value)
+ if value then
+ local nwnet = nw:get_network(value)
+ local zone = fw:get_zone("wan")
+ local fwnet = fw:get_zone_by_network(value)
+ if not nwnet then
+ nwnet = nw:add_network(value, { proto = "dhcp" })
+ end
+ if zone and not fwnet then
+ fwnet = zone:add_network(value)
+ end
+ end
+ return value
+ end
+ return m
+end
+