summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/meshwizard/files/usr
diff options
context:
space:
mode:
authorSven Roederer <freifunk@it-solutions.geroedel.de>2019-02-03 14:13:35 +0100
committerSven Roederer <freifunk@it-solutions.geroedel.de>2019-02-13 21:23:34 +0100
commit4654ba92c3999d84b08211f05d2ccb5ea9da731b (patch)
tree06cedf8e8badc0ce584d8bd5e97fab7476c81549 /contrib/package/meshwizard/files/usr
parenteda8f02dac3caa4d0f52cd1e860d7a392c295df3 (diff)
treewide: move freifunk-related packages to separate repo
Even Freifunk was one of the major factory to create the LuCI-system, it's now only a very small part of LuCI. LuCI has become a much bigger thing and it seems that it's time to move the packages only relating to Freifunk into it's own feed. On the mailinglist it was discussed [1] and a repo below the general Freifunk team on github was created. This commit removes all packages that will be hosted in the new repo [2] 1 - http://lists.freifunk.net/pipermail/wlannews-freifunk.net/2019-February/004818.html 2 - https://github.com/freifunk/openwrt-packages Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
Diffstat (limited to 'contrib/package/meshwizard/files/usr')
-rw-r--r--contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh118
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/check-range-in-range.sh31
-rw-r--r--contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/common.awk20
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh16
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_bssid.sh36
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_dhcp_ip.sh6
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh42
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/ipcalc-cidr.sh42
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh61
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh46
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6-interface.sh12
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh17
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh46
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh29
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh145
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall_interface.sh111
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh20
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_static.sh17
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh142
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh160
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh76
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh11
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_qos.sh17
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh54
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh26
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh7
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh11
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh18
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh20
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh14
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh80
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi_vap.sh23
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh32
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh147
34 files changed, 0 insertions, 1653 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh
deleted file mode 100644
index 0b99530a57..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh
+++ /dev/null
@@ -1,118 +0,0 @@
-uci_remove_list_element() {
- local option="$1"
- local value="$2"
- local list="$(uci get $option)"
- local elem
-
- uci delete $option
- for elem in $list; do
- if [ "$elem" != "$value" ]; then
- uci add_list $option=$elem
- fi
- done
-}
-
-# string_contains(string, substring)
-#
-# Returns 0 if the specified string contains the specified substring,
-# otherwise returns 1.
-string_contains() {
- string="$1"
- substring="$2"
- if test "${string#*$substring}" != "$string"
- then
- return 0 # $substring is in $string
- else
- return 1 # $substring is not in $string
- fi
-}
-
-# Takes 2 arguments
-# $1 = text to be displayed in the output for this section
-# $2 = section (optional)
-uci_commitverbose() {
- echo "+ $1"
- uci changes $2 | while read line; do
- echo " $line"
- done
- uci commit $2
-}
-
-set_defaults() {
- for def in $(env |grep "^$1" | sed 's/ /_/g'); do
- option="${def/$1/}"
- a="$(echo $option |cut -d '=' -f1)"
- b="$(echo $option |cut -d '=' -f2-)"
- b="${b//_/ }"
- string_contains "$a" "_LENGTH" && continue
- string_contains "$a" "_ITEM" && {
- # special treatment for lists. use add_list and remove the
- # item index (_ITEMx).
- uci add_list $2.${a//_ITEM[0-9]*/}="$b"
- } || {
- uci set $2.$a="$b"
- }
- done
-}
-
-# 3 arguments: 1=config name 2=oldname 3=newname
-section_rename() {
- uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.$2 $1.$3
-}
-
-msg_missing_value() {
- echo -e " \033[1mWarning:\033[0m Configuration option for $2 is missing in $1."
-}
-
-msg_success() {
- echo " Finished."
-}
-
-msg_error() {
- echo " \033[1mError: \033[0mThere was a problem."
-}
-
-msg_rename() {
- echo " Renamed unnamed section $1 to $2."
-}
-
-msg_rename_error() {
- echo " \033[1mWarning:\033[0m Could not rename $1 to $2."
-}
-
-
-restore_factory_defaults() {
- echo "+ Restore default config as requested with cleanup=1"
- cp -f /rom/etc/config/* /etc/config/
- rm /etc/config/wireless
- wifi detect > /etc/config/wireless
- rm /etc/config/network
- if [ -f /etc/init.d/defconfig ]; then
- # legacy (AA)
- /etc/init.d/defconfig start
- [ -f /rom/etc/uci-defaults/network ] && sh /rom/etc/uci-defaults/network
- else
- sh /rom/etc/uci-defaults/02_network
- fi
-}
-
-is_in_list() {
- # checks if an item is in a list
- local list="$1"
- local item="$2"
- for word in $list; do
- [ $word = "$item" ] && return 0
- done
- return 1
-}
-
-add_to_list() {
- local list="$1"
- local item="$2"
- is_in_list "$list" "$item" && echo $list
- if [ -z "$list" ]; then
- echo "$item"
- else
- echo "$list $item"
- fi
-}
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/check-range-in-range.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/check-range-in-range.sh
deleted file mode 100755
index c889c55ed0..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/check-range-in-range.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# Checks whether a netrange is inside another netrange, returns 1 if true
-# Takes two arguments: $1: net from which we want to know if it is inside $2
-# nets need to be given in CIDR notation
-
-dir=$(dirname $0)
-
-awk -f $dir/common.awk -f - $* <<EOF
-BEGIN {
-
- slpos=index(ARGV[1],"/")
- ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
- netmask=compl(2**(32-int(substr(ARGV[1],slpos+1)))-1)
- network=and(ipaddr,netmask)
- broadcast=or(network,compl(netmask))
-
- slpos2=index(ARGV[2],"/")
- ipaddr2=ip2int(substr(ARGV[2],0,slpos2-1))
- netmask2=compl(2**(32-int(substr(ARGV[2],slpos2+1)))-1)
- network2=and(ipaddr2,netmask2)
- broadcast2=or(network2,compl(netmask2))
-
- if (network >= network2) {
- if (network <= broadcast2) {
- if (broadcast <= broadcast2) {
- print "1"
- }
- }
- }
-}
-EOF
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/common.awk b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/common.awk
deleted file mode 100644
index 5b03d06bea..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/common.awk
+++ /dev/null
@@ -1,20 +0,0 @@
-function bitcount(c) {
- c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
- c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
- c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
- c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
- c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
- return c
-}
-
-function ip2int(ip) {
- for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
- return ret
-}
-
-function int2ip(ip,ret,x) {
- ret=and(ip,255)
- ip=rshift(ip,8)
- for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
- return ret
-}
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
deleted file mode 100755
index 9eca11b414..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-netrenamed=$1
-
-PREFIX="$(echo $ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
-
-# Get the devices mac address
-device="$(uci -p/var/state -q get network.$1.ifname)"
-if [ -n "$device" ]; then
- MAC="$(ifconfig $netrenamed |grep HWaddr | awk '{ print $5 '})"
-else
- MAC="$(cat /sys/class/net/$1/address)"
- IPV6_UNIQ="$(echo $MAC | awk -F: '{ print $1$2":"$3$4":"$5$6 }')"
-fi
-
-echo "${PREFIX}${IPV6_UNIQ}:1"
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_bssid.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_bssid.sh
deleted file mode 100755
index efe101fad0..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_bssid.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# create essid from channel, takes two args:
-# $1 = channel (integer)
-# $2 = community (optional)
-channel=$1
-community=$2
-
-. /lib/functions.sh
-
-
-# Try to get BSSID from profile first
-config_load profile_$community
-config_get bssid bssidscheme $channel
-if [ -z "$bssid" ]; then
- config_get bssid bssidscheme "all"
-fi
-
-if [ -z "$bssid" ]; then
- case $channel in
- [1-9])
- bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
- ;;
- 1[0-4])
- bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
- ;;
- [3-9][0-9])
- bssid="02:$channel:CA:FF:EE:EE"
- ;;
- 1[0-9][0-9])
- bssid="${channel/1/12:}:CA:FF:EE:EE"
- ;;
- *) bssid="02:CA:FF:EE:BA:BE"
- ;;
- esac
-fi
-echo $bssid
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_dhcp_ip.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_dhcp_ip.sh
deleted file mode 100755
index e559166f44..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_dhcp_ip.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# generates a dhcp-ip and netrange from a given ip/subnet
-# takes 2 arguments:
-# $1: Ip Address (of the Interface for which we want to generate an ip)
-
-echo "$1" | awk 'BEGIN { FS = "." } ; { print "6."$3"."$4".1" }'
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh
deleted file mode 100755
index c1e55224eb..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# This is only run once (usually after flashing an image from the imagebuilder)
-# It sets up the initial config for this node.
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-config_load system
-
-# Rename system config
-handle_system() {
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename system $1 system
- fi
-}
-config_foreach handle_system system
-
-if [ -n "$(uci -q get meshwizard.community)" ]; then
- set_defaults "community_" freifunk.community
- uci -q delete meshwizard.community
-fi
-
-[ -n "$profile_homepage" ] && uci set freifunk.community.homepage="$profile_homepage"
-
-[ -n "$profile_mapserver" ] && {
- uci -q delete freifunk.community.mapserver
- for m in $profile_mapserver; do
- uci add_list freifunk.community.mapserver="$m"
- done
-}
-
-uci_commitverbose "Setup community" freifunk
-
-if [ -n "$(uci -q get meshwizard.contact)" ]; then
- set_defaults "contact_" freifunk.contact
- uci -q delete meshwizard.contact && uci_commitverbose "Setup contact" freifunk
-fi
-
-if [ "$has_luci" == TRUE ]; then
- set_defaults "luci_main_" luci.main
- uci -q delete meshwizard.luci_main && uci_commitverbose "Setup luci" luci
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/ipcalc-cidr.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/ipcalc-cidr.sh
deleted file mode 100755
index 6d7a1fb56b..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/ipcalc-cidr.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-dir=$(dirname $0)
-awk -f $dir/common.awk -f - $* <<EOF
-BEGIN {
- slpos=index(ARGV[1],"/")
- if (slpos == 0) {
- ipaddr=ip2int(ARGV[1])
- netmask=ip2int(ARGV[2])
- } else {
- ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
- netmask=compl(2**(32-int(substr(ARGV[1],slpos+1)))-1)
- ARGV[4]=ARGV[3]
- ARGV[3]=ARGV[2]
- }
-
- network=and(ipaddr,netmask)
- broadcast=or(network,compl(netmask))
-
- start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
- limit=network+1
- if (start<limit) start=limit
-
- end=start+ARGV[4]
- limit=or(network,compl(netmask))-1
- if (end>limit) end=limit
-
- print "IP="int2ip(ipaddr)
- print "NETMASK="int2ip(netmask)
- print "BROADCAST="int2ip(broadcast)
- print "NETWORK="int2ip(network)
- print "NEXTNET="int2ip(broadcast + 1)
- print "PREFIX="32-bitcount(compl(netmask))
-
- # range calculations:
- # ipcalc <ip> <netmask> <start> <num>
-
- if (ARGC > 3) {
- print "START="int2ip(start)
- print "END="int2ip(end)
- }
-}
-EOF
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh
deleted file mode 100755
index b6ffb62e4a..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# These functions read the settings we need for configuration of the router
-
-read_defaults() {
- # read default values from the 3 relevant config files and export them
- # into the environment. Later loaded configs overwrite earlier ones. The
- # The ordering here is from most generic to most specific:
- # freifunk (most generic defaults)
- # profile_* (community defaults)
- # nodes custom config from meshwizard config file
-
- local community="$1"
-
- config_cb() {
- local type="$1"
- local name="$2"
- local allowed_section_types="widget"
- local allowed_section_names="
- system
- wifi_device
- wifi_iface
- interface
- alias
- dhcp
- olsr_interface
- olsr_interfacedefaults
- profile
- zone_freifunk
- include
- luci_splash
- ipv6
- luci_main
- contact
- community
- wan
- lan
- general
- ipv6
- qos
- "
-
- if [ "$type" = "widget" ]; then
- widgets=$(add_to_list "$widgets" "$name")
- fi
-
- if ([ -n "$name" ] && is_in_list "$allowed_section_names" $name) \
- || is_in_list "$allowed_section_types" $type ; then
- option_cb() {
- local option="$1"
- local value="$2"
- export "${CONFIG_SECTION}_${option}"="$value"
- }
- else
- option_cb() { return; }
- fi
- }
- config_load freifunk
- config_load profile_${community}
- config_load meshwizard
- export widgets="$widgets"
-}
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh
deleted file mode 100755
index f2d10cc9e2..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-# This script renames IB_wifi_ interface names into real interface names used on this system.
-# E.g. wireless.IB_wifi0 would become wireless.radio0 on mac80211
-
-. $dir/functions.sh
-
-posIB=-1
-
-IBwifis="$(uci show meshwizard.netconfig | grep 'IB_' | sed 's/meshwizard.netconfig\.\(IB_wifi.*\)_.*/\1/' |uniq)"
-[ -z "$(echo $IBwifis |grep IB_wifi)" ] && exit
-
-for w in $IBwifis; do
- posIB=$(( $posIB + 1 ))
- export IB_wifi$posIB="$w"
-done
-
-pos=0
-syswifis="$(uci show wireless |grep wifi-device | sed 's/wireless\.\(.*\)=.*/\1/' |uniq)"
-
-for s in $syswifis; do
- export syswifi$pos="$s"
- pos=$(( $pos + 1 ))
-done
-
-for i in `seq 0 $posIB`; do
- IBwifi=$(eval echo \$IB_wifi$i)
- syswifi=$(eval echo \$syswifi$i)
-
- if [ -n "$syswifi" ]; then
- case $IBwifi in
- IB_wifi* )
- # replace IB_wifi_* with actual wifi interface names, delete old ones first
- uci show meshwizard.netconfig | grep $IBwifi | while read line; do
- oldline=$(echo $line | cut -d "=" -f 1)
- uci set $oldline=""
- newline=$(echo $line |sed -e "s/$IBwifi/$syswifi/g" -e "s/'//g")
- uci set $newline
- done
- ;;
- esac
- unset IBwifi
- unset syswifi
- fi
-done
-
-uci_commitverbose "Renaming wifi-devices in /etc/config/meshwizard" meshwizard
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6-interface.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6-interface.sh
deleted file mode 100755
index adf3429133..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6-interface.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-net=$1
-. $dir/functions.sh
-
-ra="$(uci -q get meshwizard.netconfig.${net}_ipv6ra)"
-uci set autoipv6.${netrenamed}="interface"
-if [ -n "$ra" ]; then
- uci set autoipv6.${netrenamed}.ra=1
-fi
-
-uci_commitverbose "Setup auto-ipv6 for interface $netrenamed" autoipv6
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
deleted file mode 100755
index 8e3f015cde..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_auto-ipv6.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-. $dir/functions.sh
-
-if [ "$ipv6_config" = "auto-ipv6-fromv4" ]; then
- mode="fromv4"
-else
- mode="random"
-fi
-
-uci set autoipv6.olsr_node.enabled=1
-uci set autoipv6.olsr_node.mode="$mode"
-uci_commitverbose "Setup auto-ipv6" autoipv6
-
-uci set network.wan.accept_ra=0
-uci_commitverbose "Do not accept ra's on wan when using auto-ipv6" network
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh
deleted file mode 100755
index 8cce8319a6..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-# Sets up the dhcp part of dnsmasq
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-net="$1"
-vap="$(uci -q get meshwizard.netconfig.${net}_vap)"
-
-handle_dnsmasq() {
- config_get interface "$1" interface
- if [ "$interface" == "${netrenamed}dhcp" ]; then
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename dhcp $1 ${netrenamed}dhcp
- fi
- fi
-}
-config_load dhcp
-config_foreach handle_dnsmasq dhcp
-
-[ "$net" == "lan" ] && uci -q delete dhcp.lan
-
-if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
- uci batch <<- EOF
- set dhcp.${netrenamed}dhcp="dhcp"
- set dhcp.${netrenamed}dhcp.ignore="0"
- set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
- EOF
- set_defaults "dhcp_" dhcp.${netrenamed}dhcp
-fi
-
-ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
-if [ "$supports_vap" = 0 ] || \
- [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
- [ "$lan_is_olsr" = "1" -a "$lan_dhcp" = 1 ]; then
- uci batch <<- EOF
- set dhcp.${netrenamed}ahdhcp="dhcp"
- set dhcp.${netrenamed}ahdhcp.ignore="0"
- set dhcp.${netrenamed}ahdhcp.interface="${netrenamed}ahdhcp"
- EOF
-fi
-set_defaults "dhcp_" dhcp.${netrenamed}ahdhcp
-
-uci_commitverbose "Setup DHCP for $netrenamed" dhcp
-
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
deleted file mode 100755
index 9297f9175e..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-# Set dnsmasq config
-handle_dhcp() {
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename dhcp $1 dnsmasq
- fi
-}
-
-config_load dhcp
-config_foreach handle_dhcp dnsmasq
-
-uci batch << EOF
- set dhcp.dnsmasq.local="/$profile_suffix/"
- set dhcp.dnsmasq.domain="$profile_suffix"
-EOF
-
-config_get addnhosts dnsmasq addnhosts
-if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
- uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr"
- if [ "$ipv6_enabled" = 1 ]; then
- uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr.ipv6"
- fi
-fi
-
-uci_commitverbose "Setup dnsmasq" dhcp
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
deleted file mode 100755
index 154b2b6913..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/sh
-# Add "freifunk" firewall zone
-# If wan/lan is used for olsr then remove these networks from wan/lan zones
-# Also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community>
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config)
-
-config_load firewall
-
-# Rename firewall zone for freifunk if unnamed
-# If wan is used for olsr then set network for the firewall zone wan to ' ' to remove the wan interface from it, else add local restrict to it
-# If lan is used for olsr then set network for the firewall zone lan to ' ' to remove the lan interface from it
-
-handle_fwzone() {
- config_get name "$1" name
- config_get network "$1" network
-
- if [ "$name" == "freifunk" ]; then
- # rename section if unnamed
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename firewall $1 zone_freifunk
- fi
- fi
-
- if [ "$name" == "wan" ]; then
- if [ "$wan_is_olsr" == 1 ]; then
- uci set firewall.$1.network=' ' && uci_commitverbose "WAN is used for olsr, removed the wan interface from zone wan" firewall
- else
- uci set firewall.$1.local_restrict=1 && uci_commitverbose "Enable local_restrict for zone wan" firewall
- fi
- fi
-
- if [ "$name" == "lan" ] && [ "$lan_is_olsr" == "1" ]; then
- uci set firewall.$1.network=' ' && uci_commitverbose "LAN is used for olsr, removed the lan interface from zone lan" firewall
- fi
-}
-
-config_foreach handle_fwzone zone
-
-uci batch << EOF
- set firewall.zone_freifunk="zone"
- set firewall.zone_freifunk.name="freifunk"
- set firewall.zone_freifunk.input="$zone_freifunk_input"
- set firewall.zone_freifunk.forward="$zone_freifunk_forward"
- set firewall.zone_freifunk.output="$zone_freifunk_output"
-EOF
-
-uci_commitverbose "Setup firewall zones" firewall
-
-# Usually we need to setup masquerading for lan, except lan is an olsr interface or has an olsr hna-entry
-
-handle_interface() {
- config_get interface "$1" interface
- if [ "$interface" == "lan" ]; then
- no_masq_lan=1
- fi
-}
-config_load olsrd
-config_foreach handle_interface Interface
-
-LANIP="$(uci -q get network.lan.ipaddr)"
-if [ -n "$LANIP" ]; then
- handle_hna() {
- config_get netaddr "$1" netaddr
- if [ "$LANIP" == "$netaddr" ]; then
- no_masq_lan=1
- fi
- }
- config_foreach handle_hna Hna4
-fi
-
-currms=$(uci -q get firewall.zone_freifunk.masq_src)
-if [ ! "$no_masq_lan" == "1" ] && [ ! "$(uci -q get meshwizard.netconfig.lan_config)" == 1 ]; then
- uci set firewall.zone_freifunk.masq="1"
- [ -z "$(echo $currms |grep lan)" ] && uci add_list firewall.zone_freifunk.masq_src="lan"
-fi
-
-
-# Rules, Forwardings, advanced config and includes from freifunk and
-# profile_$community config files.
-
-add_fw_rules() {
- config_cb() {
- local type="$1"
- local name="$2"
- local allowed_section_types="advanced include fw_rule fw_forwarding"
- if is_in_list "$allowed_section_types" $type ; then
- uci set firewall.${name}="${type/fw_/}"
- option_cb() {
- local option="$1"
- local value="$2"
- uci set firewall.${CONFIG_SECTION}.${option}="$value"
- }
- else
- option_cb() { return; }
- fi
- }
- config_load freifunk
- config_load profile_${community}
-}
-add_fw_rules
-
-
-# If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone
-if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
- uci batch <<- EOF
- set firewall.dhcpv6=rule
- set firewall.dhcpv6.src=freifunk
- set firewall.dhcpv6.target=ACCEPT
- set firewall.dhcpv6.dest_port=547
- set firewall.dhcpv6.proto=udp
- EOF
-fi
-
-# Firewall rules to allow incoming ssh and web if enabled
-
-if [ "$wan_allowssh" == 1 ]; then
- uci batch <<- EOF
- set firewall.wanssh=rule
- set firewall.wanssh.src=wan
- set firewall.wanssh.target=ACCEPT
- set firewall.wanssh.proto=tcp
- set firewall.wanssh.dest_port=22
- EOF
-fi
-
-if [ "$wan_allowweb" == 1 ]; then
- uci batch <<- EOF
- set firewall.wanweb=rule
- set firewall.wanweb.src=wan
- set firewall.wanweb.target=ACCEPT
- set firewall.wanweb.proto=tcp
- set firewall.wanweb.dest_port=80
- set firewall.wanwebhttps=rule
- set firewall.wanwebhttps.src=wan
- set firewall.wanwebhttps.target=ACCEPT
- set firewall.wanwebhttps.proto=tcp
- set firewall.wanwebhttps.dest_port=443
- EOF
-fi
-
-uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall_interface.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall_interface.sh
deleted file mode 100755
index 8ca5d3b77b..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall_interface.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/sh
-# This will add $net to the zone firewall (and remove it from other zones where it is referenced)
-# It will also setup rules defined in /etc/config/freifunk and /etc/config/profile_<community>
-# Arg $1 = $net
-
-net=$1
-. /lib/functions.sh
-. $dir/functions.sh
-config_load firewall
-
-# Get some variables
-type="$(uci -q get wireless.$net.type)"
-vap="$(uci -q get meshwizard.netconfig.$net\_vap)"
-wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config)
-
-# Delete old firewall zone for freifunk
-handle_fwzone() {
- config_get name "$1" name
- config_get network "$1" network
-
- if [ "$2" == "zoneconf" ]; then
- if [ "$name" == "freifunk" ]; then
- # rename section if unnamed
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename firewall $1 zone_freifunk
- fi
- else
- if [ ! "$name" == "freifunk" ] && [ -n "$netrenamed" -a -n "$(echo $network | grep $netrenamed)" ]; then
- echo " Removed $netrenamed from firewall zone $name."
- network_new=$(echo $network | sed -e 's/'$netrenamed'//' -e 's/^ //' -e 's/ / /' -e 's/ $//')
- uci set firewall.$1.network="$network_new"
- fi
- fi
- fi
-}
-
-config_foreach handle_fwzone zone zoneconf
-
-# Add $netrenamed and if needed ${netrenamed}dhcp to the "freifunk" zone
-config_get network zone_freifunk network
-
-# remove ${netrenamed}dhcp from networks list
-[ -n "$network" -a -n "$net" ] && network="${network/${netrenamed}dhcp/}"
-network=$(echo $network) # Removes leading and trailing whitespaces
-
-[ -n "$netrenamed" ] && [ -z "$(echo $network | grep $netrenamed)" ] && network="$network $netrenamed"
-
-if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
- [ -n "$netrenamed" ] && [ "$network" == "${network/${netrenamed}dhcp/}" ] && network="$network ${netrenamed}dhcp"
-fi
-
-uci set firewall.zone_freifunk.network="$network"
-
-uci_commitverbose "Add '$netrenamed' to freifunk firewall zone" firewall
-
-currms=$(uci -q get firewall.zone_freifunk.masq_src)
-
-# If interfaces are outside of the mesh network they should be natted
-
-if [ "$vap" == 1 ]; then
- # Get dhcprange and meshnet for the dhcp interface
- if_ip="$(uci -q get network.${netrenamed}dhcp.ipaddr)"
- if_mask="$(uci -q get network.${netrenamed}dhcp.netmask)"
-
- [ -n "$if_ip" -a "$if_mask" ] && export $(ipcalc.sh $if_ip $if_mask)
- [ -n "$NETWORK" -a "$PREFIX" ] && dhcprange="$NETWORK/$PREFIX"
-
- if [ -n "$dhcprange" ]; then
- meshnet="$(uci get profile_$community.profile.mesh_network)"
- # check if the dhcprange is inside meshnet
- dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
- if [ "$dhcpinmesh" == 1 ]; then
- # needed or splash will not work
- if [ "$has_luci_splash" == TRUE ]; then
- uci set firewall.zone_freifunk.contrack="1"
- fi
- else
- uci set firewall.zone_freifunk.masq=1
- [ -z "$(echo $currms |grep ${netrenamed}dhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}dhcp"
- fi
- fi
-fi
-
-# Get dhcprange and meshnet for the adhoc dhcp interface
-if_ip="$(uci -q get network.${netrenamed}ahdhcp.ipaddr)"
-if_mask="$(uci -q get network.${netrenamed}ahdhcp.netmask)"
-
-[ -n "$if_ip" -a "$if_mask" ] && export $(ipcalc.sh $if_ip $if_mask)
-[ -n "$NETWORK" -a "$PREFIX" ] && dhcprangeah="$NETWORK/$PREFIX"
-
-if [ -n "$dhcprangeah" ]; then
- meshnet="$(uci get profile_$community.profile.mesh_network)"
- # check if the dhcprange is inside meshnet
- dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprangeah $meshnet)"
- if [ "$dhcpinmesh" == 1 ]; then
- # needed or splash will not work
- if [ "$has_luci_splash" == TRUE ]; then
- uci set firewall.zone_freifunk.contrack="1"
- fi
- else
- uci set firewall.zone_freifunk.masq=1
- [ -z "$(echo $currms |grep ${netrenamed}ahdhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}ahdhcp"
- fi
-fi
-
-
-for i in IP NETMASK BROADCAST NETWORK PREFIX; do
- unset $i
-done
-
-uci_commitverbose "Setup masquerading rules for '$netrenamed'" firewall
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
deleted file mode 100755
index 1b4f9b16fa..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_ipv6.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-[ ! "$(uci -q get network.lan)" == "interface" ] && exit
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-# Setup IPv6 for the lan interface
-
-ip6addr=""
-if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
- # get lan mac
- device="$(uci -p/var/state -q get network.lan.ifname)"
- if [ -n "device" ]; then
- ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
- fi
- uci set network.lan.ip6addr="${ip6addr}/112"
-fi
-
-uci_commitverbose "Setup ipv6 address for lan" network
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_static.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_static.sh
deleted file mode 100755
index 172dcf138b..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_lan_static.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# Setup static interface settings for lan if lan is not an olsr interface
-
-[ ! "$(uci -q get network.lan)" == "interface" ] && exit
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-uci batch << EOF
- set network.lan.proto='$lan_proto'
- set network.lan.ipaddr='$lan_ip4addr'
- set network.lan.netmask='$lan_netmask'
-EOF
-
-uci_commitverbose "Setup static ip settings for lan" network
-
-uci delete meshwizard.lan && uci commit meshwizard
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
deleted file mode 100755
index 3ad977e265..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
+++ /dev/null
@@ -1,142 +0,0 @@
-# setup entry in /etc/config/network for a interface
-# Argument $1: network interface
-
-net="$1"
-. /lib/functions.sh
-. $dir/functions.sh
-
-# Setup a (new) interface section for $net
-
-ipaddr=$(uci -q get meshwizard.netconfig.$net\_ip4addr)
-ip6addr=$(uci -q get meshwizard.netconfig.$net\_ip6addr)
-[ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr
-
-netmask=$(uci -q get meshwizard.netconfig.$net\_netmask)
-[ -z "$netmask" ] && netmask="$interface_netmask"
-[ -z "$netmask" ] && netmask="255.255.0.0"
-
-uci set network.$netrenamed="interface"
-set_defaults "interface_" network.$netrenamed
-
-uci batch << EOF
- set network.$netrenamed.proto="static"
- set network.$netrenamed.ipaddr="$ipaddr"
- set network.$netrenamed.netmask="$netmask"
-EOF
-
-if [ "$netrenamed" = "lan" ]; then
- # remove the bridge if the interface is used for olsr
- # since this script is only run in this case, no need
- # to check for lan_proto = "olsr" currently.
- uci -q delete network.lan.type
-fi
-
-# Setup IPv6 for the interface
-if [ "$ipv6_enabled" = 1 ]; then
- if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then
- ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $netrenamed)"
- uci set network.$netrenamed.ip6addr="${ip6addr}/112"
- fi
- if [ "$ipv6_config" = "static" ] && [ -n "$ip6addr" ]; then
- uci set network.$netrenamed.ip6addr="$ip6addr"
- fi
-fi
-
-uci_commitverbose "Setup interface $netrenamed" network
-
-# setup dhcp alias/interface
-
-net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
-if [ "$net_dhcp" == 1 ]; then
-
- # Load meshwizard_settings
- dhcprange="$(uci -q get meshwizard.netconfig.${net}_dhcprange)"
- interface_ip="$(uci -q get meshwizard.netconfig.${net}_ip4addr)"
- vap=$(uci -q get meshwizard.netconfig.${net}_vap)
-
- # Rename config
- handle_dhcpalias() {
- config_get interface "$1" interface
- if [ "$interface" == "$netrenamed" ]; then
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename network $1 ${netrenamed}dhcp
- fi
- fi
- }
- config_load network
- config_foreach handle_dhcpalias interface
-
- # Get IP/netmask and start-ip for $net dhcp
- # If no dhcprange is given in /etc/config/meshwizard we autogenerate one
-
- if [ -z "$dhcprange" ]; then
- dhcprange="$($dir/helpers/gen_dhcp_ip.sh $interface_ip)/24"
- uci set meshwizard.netconfig.${net}_dhcprange="$dhcprange"
- fi
-
- # If we use VAP and also offer dhcp on the adhoc interface then cut the dhcp
- # range in two halves. one for the adhoc, one for the managed VAP interface
- ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
-
- if [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
- # VAPs are enabled for this interface, supported and we want to
- # also use DHCP on the adhoc interface
- network=${dhcprange%%/*}
- mask=${dhcprange##*/}
- # Divide network size by adding 1 to the netmask
- mask=$(($mask + 1))
- # Get first ip and netmask for the adhoc dhcp network
- eval $(sh $dir/helpers/ipcalc-cidr.sh ${network}/${mask} 1 0)
- STARTADHOC=$START
- NETMASKADHOC=$NETMASK
- # Get first ip and netmask for the managed dhcp network
- eval $(sh $dir/helpers/ipcalc-cidr.sh ${NEXTNET}/${mask} 1 0)
- STARTVAP=$START
- NETMASKVAP=$NETMASK
- # Add dhcp interface
- uci batch <<- EOF
- set network.${netrenamed}dhcp=interface
- set network.${netrenamed}dhcp.proto=static
- set network.${netrenamed}dhcp.ipaddr="$STARTVAP"
- set network.${netrenamed}dhcp.netmask="$NETMASKVAP"
- EOF
- uci_commitverbose "Setup interface for ${netrenamed}dhcp" network
- else
- eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange 1 0)
- STARTADHOC=$START
- NETMASKADHOC=$NETMASK
- fi
- if [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" != 1 ]; then
- # vaps are enabled and supported and we do not use DHCP on adhoc
- # Add dhcp interface
- uci batch <<- EOF
- set network.${netrenamed}dhcp=interface
- set network.${netrenamed}dhcp.proto=static
- set network.${netrenamed}dhcp.ipaddr="$STARTADHOC"
- set network.${netrenamed}dhcp.netmask="$NETMASKADHOC"
- EOF
- uci_commitverbose "Setup interface for ${netrenamed}dhcp" network
- fi
-
-
- # Setup alias for $net adhoc interface
- if [ "$supports_vap" = 0 ] || \
- [ "$vap" = 0 ] || \
- [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
- [ "$lan_is_olsr" = "1" ]; then
- # setup an alias interface for the main interface to use as a network for clients
- # when one of the following conditions is met
- # * vaps are not supported
- # * or not enabled
- # * or they are supported and enabled but we also want to use DHCP on the adhoc interface
- # * or this is the lan interface and it is used for olsrd (and dhcp is enabled)
- uci batch <<- EOF
- set network.${netrenamed}ahdhcp=interface
- set network.${netrenamed}ahdhcp.ifname="@${netrenamed}"
- set network.${netrenamed}ahdhcp.proto=static
- set network.${netrenamed}ahdhcp.ipaddr="$STARTADHOC"
- set network.${netrenamed}ahdhcp.netmask="$NETMASKADHOC"
- EOF
- uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network
- fi
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
deleted file mode 100755
index a435e4b1b8..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh
-# Sets up olsrd
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-protocols="4"
-if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
- protocols="4 6"
-fi
-
-clean_config() {
- # Clean the config, remove interface wlan
- handle_interface() {
- config_get interface "$1" interface
- if [ "$interface" = "wlan" ]; then
- uci delete $cfg.$1
- fi
- }
- config_foreach handle_interface Interface
-}
-
-rename_olsrd() {
- #Rename olsrd basic settings
- handle_olsrd() {
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename $cfg $1 olsrd
- fi
- }
- config_foreach handle_olsrd olsrd
-}
-
-rename_interface_defaults() {
- # Rename interface defaults
- handle_interfacedefaults() {
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename $cfg $1 InterfaceDefaults
- fi
- }
- config_foreach handle_interfacedefaults InterfaceDefaults
-}
-
-cleanup_plugins() {
- # Rename nameservice, dyngw and httpinfo plugins
- handle_plugin() {
- config_get library "$1" library
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- new="$(echo $library | cut -d '.' -f 1)"
- section_rename $cfg "$1" "$new"
- fi
- }
- config_foreach handle_plugin LoadPlugin
- uci -q delete $cfg.olsrd_httpinfo
- uci -q delete $cfg.olsrd_dyn_gw
-}
-
-setup_nameservice() {
- # Setup nameservice plugin
- if [ -n "$profile_suffix" ]; then
- suffix=".$profile_suffix"
- else
- suffix=".olsr"
- fi
- local llfile="/var/run/latlon.js"
- local hosts="/var/etc/hosts.olsr"
- local services="/var/run/services_olsr"
-
- if [ "$proto" = "6" ]; then
- local llfile="/var/run/latlon.js.ipv6"
- local hosts="/var/etc/hosts.olsr.ipv6"
- local services="/var/run/services_olsr.ipv6"
- fi
-
- uci batch <<- EOF
- set $cfg.olsrd_nameservice=LoadPlugin
- set $cfg.olsrd_nameservice.library="olsrd_nameservice"
- set $cfg.olsrd_nameservice.latlon_file="$llfile"
- set $cfg.olsrd_nameservice.hosts_file="$hosts"
- set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
- set $cfg.olsrd_nameservice.services_file="$services"
- set $cfg.olsrd_nameservice.suffix="$suffix"
- EOF
-
- uci_commitverbose "Setup olsr nameservice plugin" $cfg
-}
-
-setup_dyngw_plain() {
- # Setup dyngw_plain
- # If Sharing of Internet is enabled then enable dyngw_plain plugin
-
- if [ "$general_sharenet" == 1 ]; then
- uci set $cfg.dyngw_plain=LoadPlugin
- uci set $cfg.dyngw_plain.ignore=0
- uci set $cfg.dyngw_plain.library="olsrd_dyn_gw_plain"
- uci_commitverbose "Setup olsrd_dyngw_plain plugin" $cfg
- fi
-
-}
-
-setup_watchdog() {
- # Setup watchdog
- local watchdogfile="/var/run/olsrd.watchdog"
- if [ "$proto" = "6" ]; then
- watchdogfile="/var/run/olsrd.watchdog.ipv6"
- fi
-
- uci batch <<- EOF
- set $cfg.olsrd_watchdog=LoadPlugin
- set $cfg.olsrd_watchdog.library="olsrd_watchdog"
- set $cfg.olsrd_watchdog.file="$watchdogfile"
- set $cfg.olsrd_watchdog.interval=30
- EOF
- uci_commitverbose "Setup olsr watchdog plugin" $cfg
-
-}
-
-setup_jsoninfo() {
- proto="$1"
- uci batch <<- EOF
- set $cfg.olsrd_jsoninfo=LoadPlugin
- set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo"
- EOF
- if [ "$proto" = "6" ]; then
- uci set $cfg.olsrd_jsoninfo.ipv6only='1'
- fi
- uci_commitverbose "Setup olsr jsoninfo plugin" $cfg
-}
-
-setup_txtinfo() {
- proto="$1"
- uci batch <<- EOF
- set $cfg.olsrd_txtinfo=LoadPlugin
- set $cfg.olsrd_txtinfo.library="olsrd_txtinfo"
- EOF
- if [ "$proto" = "6" ]; then
- uci set $cfg.olsrd_txtinfo.ipv6only='1'
- fi
- uci_commitverbose "Setup olsr txtinfo plugin" $cfg
-}
-
-
-for proto in $protocols; do
- cfg="olsrd"
- [ "$proto" == "6" ] && cfg="olsrd6"
- config_load $cfg
- clean_config
- rename_olsrd
- cleanup_plugins
-
- uci set $cfg.olsrd.IpVersion="$proto"
- uci set $cfg.InterfaceDefaults=InterfaceDefaults
- set_defaults "olsr_interfacedefaults_" $cfg.InterfaceDefaults
- uci_commitverbose "Cleanup olsrd config" $cfg
-
- setup_nameservice
- setup_dyngw_plain
- setup_watchdog
- setup_jsoninfo $proto
- setup_txtinfo $proto
-done
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh
deleted file mode 100755
index 59f99bd0a1..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd_interface.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-# Sets up olsrd interfaces
-# arg $1 = net
-
-net=$1
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-protocols="4"
-if [ "$ipv6_enabled" = 1 ] && [ "$has_ipv6" == "1" ]; then
- protocols="4 6"
-fi
-
-for proto in $protocols; do
-
- cfg="olsrd"
- [ "$proto" == "6" ] && cfg="olsrd6"
-
- # Rename interface for $netrenamed
- handle_interface() {
- config_get interface "$1" Interface
- if [ "$interface" == "$netrenamed" ]; then
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename $cfg $1 $netrenamed
- fi
- fi
- }
-
- config_foreach handle_interface Interface
-
- # Setup new interface for $netrenamed
-
- uci set $cfg.$netrenamed=Interface
- set_defaults "olsr_interface_" $cfg.$net
- uci set $cfg.$netrenamed.interface="$netrenamed"
-
- uci_commitverbose "Setup olsr interface for $netrenamed." $cfg
-
- if [ "$proto" = "4" ]; then
- # If dhcp-network is inside the mesh_network then add HNA for it
-
- dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange)
- uci -q delete $cfg.${netrenamed}clients
-
- if [ -n "$dhcprange" ]; then
- meshnet="$(uci get profile_$community.profile.mesh_network)"
- dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
-
- if [ "$dhcpinmesh" == 1 ] && [ -n "$meshnet" ]; then
- uci set $cfg.${netrenamed}clients="Hna4"
- eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange)
- uci set $cfg.${netrenamed}clients.netaddr="$NETWORK"
- uci set $cfg.${netrenamed}clients.netmask="$NETMASK"
- uci_commitverbose "Setup HNA for network $dhcprange" $cfg
- fi
- fi
- fi
-
- if [ "$proto" = "6" ]; then
- # Set Hna entry for ipv6 net for static ipv6 config
- uci -q delete $cfg.${netrenamed}static
- if [ "$ipv6_config" = "static" ]; then
- v6range="$(uci -q get meshwizard.netconfig.$net\_ip6addr)"
- v6net="$(echo $v6range | cut -d '/' -f 1)"
- v6mask="$(echo $v6range | cut -d '/' -f 2)"
- if [ -n "$v6net" ] && [ -n "$v6mask" ]; then
- uci set $cfg.${netrenamed}static="Hna6"
- uci set $cfg.${netrenamed}static.netaddr="$v6net"
- uci set $cfg.${netrenamed}static.prefix="$v6mask"
- uci_commitverbose "Setup HNA for network $v6range" $cfg
- fi
- fi
- fi
-
-done \ No newline at end of file
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh
deleted file mode 100755
index f898bd6842..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_policyrouting.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-. $dir/functions.sh
-
-uci batch << EOF
- set freifunk-policyrouting.pr.enable=1
- set freifunk-policyrouting.pr.strict=1
- set freifunk-policyrouting.pr.zones="freifunk"
-EOF
-
-uci_commitverbose "Setup policyrouting" freifunk-policyrouting
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_qos.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_qos.sh
deleted file mode 100755
index 25884b30d5..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_qos.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# sets up qos-scripts for the wan interface
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-if [ ! -f /etc/config/qos ]; then
- echo "NOT setting up QOS because /etc/config/qos-scripts was not found"
-else
- uci batch <<- EOF
- set qos.wan.enabled=1
- set qos.wan.upload=$wan_up
- set qos.wan.download=$wan_down
- EOF
- uci_commitverbose "Setup QOS on WAN interface." qos
-
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh
deleted file mode 100755
index 3c3e6a32e2..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-# Setup_splash, takes 1 argument: 1=net
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-net=$1
-vap=$(uci -q get meshwizard.netconfig.${net}_vap)
-
-if [ ! "$has_luci_splash" == TRUE ]; then
- echo " Luci Splash is not installed, skipping setup of it."
- exit
-fi
-
-set_defaults "luci_splash_" luci_splash.general
-uci_commitverbose "Setup general splash settings" luci_splash
-
-dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange)
-
-splash_net_add() {
- uci batch <<- EOF
- set luci_splash.$1="iface"
- set luci_splash.$1.network="$1"
- set luci_splash.$1.zone="freifunk"
- EOF
-}
-
-if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" = 1 ] && [ -n "$dhcprange" ]; then
- handle_splash() {
- config_get network "$1" network
- if [ "$network" == "${netrenamed}dhcp" ]; then
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename luci_splash $1 ${netrenamed}dhcp
- fi
- fi
- }
- config_load luci_splash
- config_foreach handle_splash iface
-
- if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
- splash_net_add ${netrenamed}dhcp
- uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
- fi
-
- ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
- if [ "$supports_vap" = 0 ] || \
- [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \
- [ "$lan_dhcp" = 1 ]; then
- splash_net_add ${netrenamed}ahdhcp
- uci_commitverbose "Setup dhcpsplash for ${netrenamed}ahdhcp" luci_splash
- fi
- /etc/init.d/luci_splash enable
-fi
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
deleted file mode 100755
index 38b331e71b..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Setup ssh. At this point only used to store pubkeys.
-
-[ ! "$(uci -q get meshwizard.ssh)" == "system" ] && exit
-
-. /lib/functions.sh
-. $dir/functions.sh
-authorized="/etc/dropbear/authorized_keys"
-
-
-config_load meshwizard
-
-i=0
-handle_pubkeys() {
- local k="$1"
- ( [ -f "$authorized" ] && grep -q "$k" $authorized) || {
- echo "$k" >> $authorized
- i=`expr $i + 1`
- }
-}
-
-config_list_foreach ssh pubkey handle_pubkeys
-
-uci delete meshwizard.ssh
-uci_commitverbose "Added $i pubkeys to authorized_keys" meshwizard
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh
deleted file mode 100755
index e9ce953f15..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-. $dir/functions.sh
-
-set_defaults "system_" system.system
-uci -q delete meshwizard.system && uci commit meshwizard
-uci_commitverbose "System config" system
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh
deleted file mode 100755
index b25a1756ca..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_uhttpd.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-. $dir/functions.sh
-if [ "$ipv6_enabled" = "1" ]; then
- uci batch <<- EOF
- set uhttpd.main.listen_http="80"
- set uhttpd.main.listen_https="443"
- EOF
-fi
-
-uci_commitverbose "Setup uhttpd" uhttpd
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
deleted file mode 100755
index 91fc1d8dab..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-# Setup dhcp interface settings for wan. This is the OpenWrt default,
-# so all we need to do here is to delete wan from meshwizard after setup.
-# Also disallow ra on wan if ipv6 is enabled
-
-[ ! "$(uci -q get network.wan)" == "interface" ] && exit
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-if [ "$ipv6_enabled" = "1" ]; then
- uci set network.wan.accept_ra='0'
- uci_commitverbose "Do not accept ra on wan interface" network
-fi
-
-
-uci delete meshwizard.wan && uci commit meshwizard
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
deleted file mode 100755
index 570470aa77..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# Setup static interface settings for wan if wan is not an olsr interface
-
-[ ! "$(uci -q get network.wan)" == "interface" ] && exit
-
-. /lib/functions.sh
-. $dir/functions.sh
-
-uci batch << EOF
-set network.wan.proto='$wan_proto'
-set network.wan.ipaddr='$wan_ip4addr'
-set network.wan.netmask='$wan_netmask'
-set network.wan.gateway='$wan_gateway'
-set network.wan.dns='$wan_dns'
-EOF
-
-uci_commitverbose "Setup static ip settings for wan" network
-
-uci delete meshwizard.wan && uci commit meshwizard
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh
deleted file mode 100755
index 288252f37b..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-. /lib/functions.sh
- . $dir/functions.sh
-
-if [ -n "$widgets" ]; then
- [ ! -f "/etc/config/freifunk-widgets" ] && touch /etc/config/freifunk-widgets
- for w in $widgets; do
- uci set freifunk-widgets.${w}=widget
- set_defaults "${w}_" freifunk-widgets.${w}
- uci delete profile_$community.${w}
- done
- uci commit profile_$community
- uci_commitverbose "Added widget config." freifunk-widgets
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
deleted file mode 100755
index 707b7b72cd..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-# sets up a wifi interface for meshing
-# Arguments: $1 = network interface
-
-net="$1"
-. /lib/functions.sh
-. $dir/functions.sh
-
-##### wifi-device #####
-
-# Get the type before we delete the wifi-device
-config_load wireless
-config_get type $net type
-
-# Rename wifi-device for $net
-
-handle_wifidevice() {
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename wireless $1 $net
- fi
-}
-config_foreach handle_wifidevice wifi-device
-
-# create new wifi-device for $net
-uci set wireless.${net}=wifi-device
-
-# get and set wifi-device defaults
-set_defaults "wifi_device_" wireless.${net}
-
-channel="$(uci -q get meshwizard.netconfig.$net\_channel)"
-
-if [ -z "$channel" -o "$channel" == "default" ]; then
- channel=$wifi_device_channel
-fi
-
-uci batch << EOF
- set wireless.${net}.type="$type"
- set wireless.${net}.channel="$channel"
-EOF
-
-uci_commitverbose "Setup wifi device for $netrenamed" wireless
-
-##### wifi iface
-
-# Rename wifi-iface for $net
-handle_interface() {
- config_get device "$1" device
- if [ "$device" == "$net" ]; then
- if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
- section_rename wireless $1 ${net}_iface
- fi
- fi
-}
-config_foreach handle_interface wifi-iface
-
-# create new wifi-device for $net
-uci set wireless.$net\_iface=wifi-iface
-
-# create new wifi-iface for $net from defaults
-set_defaults "wifi_iface_" wireless.$net\_iface
-
-# overwrite defaults
-bssid="$($dir/helpers/gen_bssid.sh $channel $community)"
-
-ssid="$profile_ssid"
-if [ "$profile_ssid_scheme" == "addchannel" ]; then
- ssid="$ssid - ch$channel"
-elif [ "$profile_ssid_scheme" == "addchannelbefore" ]; then
- ssid="ch$channel.$ssid"
-fi
-
-uci batch << EOF
- set wireless.$net\_iface.device="${net}"
- set wireless.$net\_iface.network="$netrenamed"
- set wireless.$net\_iface.ssid="$ssid"
- set wireless.$net\_iface.bssid="$bssid"
-EOF
-
-uci_commitverbose "Setup wifi interface for $netrenamed" wireless
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi_vap.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi_vap.sh
deleted file mode 100755
index df58ad76d3..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi_vap.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-# sets up a wifi interface for meshing
-# Arguments: $1 = network interface
-
-net="$1"
-. /lib/functions.sh
-. $dir/functions.sh
-
-## Setup a VAP interface in AP Mode
-ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
-vap="$(uci -q get meshwizard.netconfig.$net\_vap)"
-
-if [ "$supports_vap" == 1 -a "$vap" == 1 ]; then
- uci batch <<- EOF
- set wireless.$net\_iface_dhcp="wifi-iface"
- set wireless.$net\_iface_dhcp.device="$net"
- set wireless.$net\_iface_dhcp.mode="ap"
- set wireless.$net\_iface_dhcp.encryption="none"
- set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp"
- set wireless.$net\_iface_dhcp.ssid="Freifunk-$ip4addr"
- EOF
- uci_commitverbose "Setup VAP interface for $netrenamed" wireless
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
deleted file mode 100755
index 7fdff3c566..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-# checks if a given device can be used for a VAP interface (1 adhoc + 1 ap)
-dev="$1"
-type="$2"
-
-
-if [ -z "$dev" -o -z "$type" ]; then
- exit 1
-fi
-
-if [ "$type" = "mac80211" ]; then
- # not hostapd[-mini], no VAP
- if [ ! -x /usr/sbin/hostapd ]; then
- echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211."
- exit 1
- fi
- # get driver in use
- netindex="$(echo $dev |sed 's/[a-zA-z]*//')"
- if [ -d /sys/class/net/wlan${netindex}/device/driver/module ]; then
- driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
- if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
- exit 0
- else
- exit 1
- fi
- else
- exit 1
- fi
-else
- exit 1
-fi
-
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
deleted file mode 100755
index 450473868e..0000000000
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/sh
-
-# This collection of scripts will take settings from /etc/config/meshwizard, /etc/config/freifunk
-# and /etc/config/profile_<community> and setup the router to participate in wireless mesh networks
-
-# Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
-
-# 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
-
-echo "
-/* Meshwizard 0.3.1 */
-"
-
-# config
-export dir="/usr/bin/meshwizard"
-
-. /lib/functions.sh
-. $dir/functions.sh
-. $dir/helpers/read_defaults.sh
-[ -f /proc/net/ipv6_route ] && export has_ipv6=1
-
-# Check which packages we have installed
-export has_luci=FALSE
-opkg list_installed |grep luci-mod-admin > /dev/null && export has_luci=TRUE
-export has_luci_splash=FALSE
-opkg list_installed |grep luci-app-splash > /dev/null && export has_luci_splash=TRUE
-
-# Check whether we want to cleanup/restore uci config before setting new options
-cleanup=$(uci -q get meshwizard.general.cleanup)
-[ "$cleanup" == 1 ] && restore_factory_defaults
-
-# Rename wifi interfaces
-$dir/helpers/rename-wifi.sh
-
-export lan_is_olsr="$(uci -q get meshwizard.netconfig.lan_config)"
-
-# Get community
-community="$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name)"
-[ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1
-export community="$community"
-
-# we need a list of widgets later on. It will be populated in read_defaults.sh
-widgets=""
-
-# Get a list of networks we need to setup
-networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq)
-export networks
-[ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1
-
-# Read defaults and node config
-read_defaults $community
-
-# Do config
-$dir/helpers/initial_config.sh
-$dir/helpers/setup_dnsmasq.sh
-$dir/helpers/setup_system.sh
-$dir/helpers/setup_olsrd.sh
-$dir/helpers/setup_firewall.sh
-$dir/helpers/setup_ssh.sh
-$dir/helpers/setup_uhttpd.sh
-$dir/helpers/setup_widgets.sh
-
-if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
- $dir/helpers/setup_wan_static.sh
-fi
-
-if [ "$wan_proto" == "dhcp" ]; then
- $dir/helpers/setup_wan_dhcp.sh
-fi
-
-if [ -n "$wan_down" -a -n "$wan_up" ]; then
- $dir/helpers/setup_qos.sh
-fi
-
-if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask" ]; then
- $dir/helpers/setup_lan_static.sh
-fi
-
-if [ "$ipv6_enabled" == 1 ] && [ "$has_ipv6" = 1 ]; then
- $dir/helpers/setup_lan_ipv6.sh
- # Setup auto-ipv6
- if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then
- $dir/helpers/setup_auto-ipv6.sh
- fi
-fi
-
-# Setup policyrouting if internet sharing is disabled and wan is not used for olsrd
-# Always disable it first to make sure its disabled when the user decied to share his internet
-uci set freifunk-policyrouting.pr.enable=0
-if [ ! "$general_sharenet" == 1 ] && [ ! "$(uci -q get meshwizard.netconfig.wan_proto)" == "olsr" ]; then
- $dir/helpers/setup_policyrouting.sh
-fi
-
-# Configure found networks
-for net in $networks; do
- # radioX devices need to be renamed
- netrenamed="${net/radio/wireless}"
- export netrenamed
-
- if [ ! "$net" == "wan" ] && [ ! "$net" == "lan" ]; then
- $dir/helpers/setup_wifi.sh $net
- # check if this net supports vap
- /sbin/wifi # wifi needs to be up for the check
- export supports_vap="0"
- type="$(uci -q get wireless.$net.type)"
- [ -n "$type" ] && $dir/helpers/supports_vap.sh $net $type && export supports_vap=1
- if [ "$supports_vap" = 1 ]; then
- $dir/helpers/setup_wifi_vap.sh $net
- fi
- fi
-
- $dir/helpers/setup_network.sh $net
-
- $dir/helpers/setup_olsrd_interface.sh $net
-
- net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
- export ${net}_dhcp=$net_dhcp
-
- if [ "$net" = "lan" ] && [ "$lan_is_olsr" = "1" ]; then
- uci -q set dhcp.lan.ignore="1"
- uci_commitverbose "Disable DHCP on LAN because it is an olsr interface." dhcp
- fi
-
- if [ "$net_dhcp" == 1 ]; then
- $dir/helpers/setup_dhcp.sh $net
- fi
-
- $dir/helpers/setup_splash.sh $net
- $dir/helpers/setup_firewall_interface.sh $net
-
- if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then
- $dir/helpers/setup_auto-ipv6-interface.sh $net
- fi
-done
-
-##### postinstall script
-
-[ -f /etc/rc.local.meshkitpostinstall ] && /etc/rc.local.meshkitpostinstall
-
-
-##### Reboot the router (because simply restarting services gave errors)
-
-echo "+ The wizard has finished and the router will reboot now."
-
-reboot