mirror of https://github.com/openwrt/luci.git
applications: Remove ffwizard, is replaced by meshwizard
parent
8cd46b595a
commit
e05ec34787
|
@ -1,4 +0,0 @@
|
|||
PO = ffwizard
|
||||
|
||||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -1,27 +0,0 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
Copyright 2011 Patrick Grimm <patrick@pberg.freifunk.net>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
$Id$
|
||||
|
||||
]]--
|
||||
|
||||
module "luci.controller.ffwizard"
|
||||
|
||||
function index()
|
||||
entry({"admin", "freifunk", "ffwizard"}, form("freifunk/ffwizard"), _("Wizard"), 40).i18n = "ffwizard"
|
||||
assign({"mini", "freifunk", "ffwizard"}, {"admin", "freifunk", "ffwizard"}, _("Wizard"), 40)
|
||||
|
||||
entry({"admin", "freifunk", "ffwizard_error"}, template("freifunk/ffwizard_error")).i18n = "ffwizard"
|
||||
assign({"mini", "freifunk", "ffwizard_error"}, {"admin", "freifunk", "ffwizard_error"})
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,149 +0,0 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
$Id$
|
||||
|
||||
]]--
|
||||
|
||||
local uci = require "luci.model.uci"
|
||||
local util = require "luci.util"
|
||||
local table = require "table"
|
||||
|
||||
local type = type
|
||||
|
||||
module "luci.tools.ffwizard"
|
||||
|
||||
-- Deletes all references of a wifi device
|
||||
function wifi_delete_ifaces(device)
|
||||
local cursor = uci.cursor()
|
||||
cursor:delete_all("wireless", "wifi-iface", {device=device})
|
||||
cursor:save("wireless")
|
||||
end
|
||||
|
||||
-- Deletes a network interface and all occurences of it in firewall zones and dhcp
|
||||
function network_remove_interface(iface)
|
||||
local cursor = uci.cursor()
|
||||
|
||||
if not cursor:delete("network", iface) then
|
||||
return false
|
||||
end
|
||||
|
||||
local aliases = {iface}
|
||||
cursor:foreach("network", "alias",
|
||||
function(section)
|
||||
if section.interface == iface then
|
||||
table.insert(aliases, section[".name"])
|
||||
end
|
||||
end)
|
||||
|
||||
-- Delete Aliases and Routes
|
||||
cursor:delete_all("network", "route", {interface=iface})
|
||||
cursor:delete_all("network", "alias", {interface=iface})
|
||||
|
||||
-- Delete DHCP sections
|
||||
cursor:delete_all("dhcp", "dhcp",
|
||||
function(section)
|
||||
return util.contains(aliases, section.interface)
|
||||
end)
|
||||
|
||||
-- Remove OLSR sections
|
||||
cursor:delete_all("olsrd", "Interface", {Interface=iface})
|
||||
|
||||
-- Remove Splash sections
|
||||
cursor:delete_all("luci-splash", "iface", {network=iface})
|
||||
|
||||
cursor:save("network")
|
||||
cursor:save("olsr")
|
||||
cursor:save("dhcp")
|
||||
cursor:save("luci-splash")
|
||||
end
|
||||
|
||||
-- Creates a firewall zone
|
||||
function firewall_create_zone(zone, input, output, forward, masq)
|
||||
local cursor = uci.cursor()
|
||||
if not firewall_find_zone(zone) then
|
||||
local stat = cursor:section("firewall", "zone", nil, {
|
||||
input = input,
|
||||
output = output,
|
||||
forward = forward,
|
||||
masq = masq and "1",
|
||||
name = zone
|
||||
})
|
||||
cursor:save("firewall")
|
||||
return stat
|
||||
end
|
||||
end
|
||||
|
||||
-- Adds interface to zone, creates zone on-demand
|
||||
function firewall_zone_add_interface(name, interface)
|
||||
local cursor = uci.cursor()
|
||||
local zone = firewall_find_zone(name)
|
||||
local net = cursor:get("firewall", zone, "network")
|
||||
local old = net or (cursor:get("network", name) and name)
|
||||
cursor:set("firewall", zone, "network", (old and old .. " " or "") .. interface)
|
||||
cursor:save("firewall")
|
||||
end
|
||||
|
||||
-- Removes interface from zone
|
||||
function firewall_zone_remove_interface(name, interface)
|
||||
local cursor = uci.cursor()
|
||||
local zone = firewall_find_zone(name)
|
||||
if zone then
|
||||
local net = cursor:get("firewall", zone, "network")
|
||||
local new = remove_list_entry(net, interface)
|
||||
if new then
|
||||
if #new > 0 then
|
||||
cursor:set("firewall", zone, "network", new)
|
||||
else
|
||||
cursor:delete("firewall", zone, "network")
|
||||
end
|
||||
cursor:save("firewall")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Finds the firewall zone with given name
|
||||
function firewall_find_zone(name)
|
||||
local find
|
||||
|
||||
uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
if section.name == name then
|
||||
find = section[".name"]
|
||||
end
|
||||
end)
|
||||
|
||||
return find
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Helpers --
|
||||
|
||||
-- Removes a listentry, handles real and pseduo lists transparently
|
||||
function remove_list_entry(value, entry)
|
||||
if type(value) == "nil" then
|
||||
return nil
|
||||
end
|
||||
|
||||
local result = type(value) == "table" and value or util.split(value, " ")
|
||||
local key = util.contains(result, entry)
|
||||
|
||||
while key do
|
||||
table.remove(result, key)
|
||||
key = util.contains(result, entry)
|
||||
end
|
||||
|
||||
result = type(value) == "table" and result or table.concat(result, " ")
|
||||
return result ~= value and result
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
<%+header%>
|
||||
|
||||
<%
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local basicsurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics")
|
||||
local hostname = uci:get_first ("system", "system", "hostname")
|
||||
local latitude = uci:get_first ("system", "system", "latitude")
|
||||
local longitude = uci:get_first ("system", "system", "longitude")
|
||||
local location = uci:get_first ("system", "system", "location")
|
||||
%>
|
||||
|
||||
<h2><%:Error%></h2>
|
||||
|
||||
<%:You can not use the wizard because some necessary values are missing.%>
|
||||
<p/>
|
||||
|
||||
<%
|
||||
local co = uci:get("freifunk", "community", "name")
|
||||
if not (co and hostname and latitude and longitude and location) then
|
||||
%>
|
||||
<%:Basic settings are incomplete. Please go to%> <a href='<%=basicsurl%>'><%:Basic settings%></a> <%:and fill out all required fields.%>
|
||||
<p/>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%+footer%>
|
|
@ -1,80 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# prevent running on sdk
|
||||
type config_get >/dev/null 2>/dev/null || exit 0
|
||||
|
||||
set_default_config()
|
||||
{
|
||||
local cfg="$1"
|
||||
config_get type "$cfg" "type"
|
||||
case $type in
|
||||
atheros)
|
||||
uci -q batch <<-EOF
|
||||
set freifunk.wifi_device.channel=1
|
||||
set freifunk.wifi_device.diversity=1
|
||||
set freifunk.wifi_device.disabled=0
|
||||
set freifunk.wifi_device.txpower=""
|
||||
set freifunk.wifi_device.hwmode=11g
|
||||
set freifunk.wifi_device.distance=1000
|
||||
set freifunk.wifi_iface=defaults
|
||||
set freifunk.wifi_iface.mode=adhoc
|
||||
set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
|
||||
set freifunk.wifi_iface.sw_merge=1
|
||||
set freifunk.wifi_iface.mcast_rate=5500
|
||||
set freifunk.wifi_iface.probereq=1
|
||||
commit freifunk
|
||||
EOF
|
||||
;;
|
||||
mac80211)
|
||||
uci -q batch <<-EOF
|
||||
set freifunk.wifi_device.channel=1
|
||||
set freifunk.wifi_device.diversity=1
|
||||
set freifunk.wifi_device.disabled=0
|
||||
set freifunk.wifi_device.txpower=""
|
||||
set freifunk.wifi_device.distance=1000
|
||||
set freifunk.wifi_device.htmode='HT40-'
|
||||
set freifunk.wifi_device.hwmode=11ng
|
||||
set freifunk.wifi_iface=defaults
|
||||
set freifunk.wifi_iface.mode=adhoc
|
||||
set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
|
||||
set freifunk.wifi_iface.sw_merge=""
|
||||
commit freifunk
|
||||
EOF
|
||||
;;
|
||||
broadcom)
|
||||
uci -q batch <<-EOF
|
||||
set freifunk.wifi_device.channel=1
|
||||
set freifunk.wifi_device.diversity=1
|
||||
set freifunk.wifi_device.disabled=0
|
||||
set freifunk.wifi_device.txpower=""
|
||||
set freifunk.wifi_device.hwmode=11g
|
||||
set freifunk.wifi_device.distance=1000
|
||||
set freifunk.wifi_iface=defaults
|
||||
set freifunk.wifi_iface.encryption=none
|
||||
set freifunk.wifi_iface.mode=adhoc
|
||||
set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
|
||||
set freifunk.wifi_iface.sw_merge=""
|
||||
commit freifunk
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
(
|
||||
while true ; do
|
||||
sleep 30
|
||||
wifie=0
|
||||
|
||||
config_load wireless && wifie=1
|
||||
|
||||
if [ $wifie -eq 1 ] ; then
|
||||
config_foreach set_default_config wifi-device
|
||||
|
||||
uci set freifunk.interface.dns="88.198.178.18 141.54.1.1 212.204.49.83 8.8.8.8 8.8.4.4"
|
||||
uci commit freifunk
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
) >/dev/null &
|
Loading…
Reference in New Issue