2 # This script will take settings from /etc/config/meshwizard, /etc/config/freifunk and /etc/config/profile_<selected in freifunk>
3 # and setup the router to participate in wireless mesh networks
8 export dir="/usr/bin/meshwizard"
12 # Rename wifi interfaces
13 echo "++++ Renaming wifi-devices in /etc/config/meshwizard"
14 $dir/helpers/rename-wifi.sh
16 # Firstboot/initial config
17 echo "++++ Initial config"
18 $dir/helpers/initial_config.sh
21 export community=$(uci get freifunk.community.name)
22 [ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1
24 # Check whether we want to cleanup uci config before setting new options or not
25 cleanup=$(uci -q get meshwizard.general.cleanup)
27 [ "$cleanup" == 1 ] && export cleanup=1
29 # Get a list of networks we need to setup
30 networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq)
33 [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1
35 echo "+++ wizard 0.0.2 +++
39 # Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community,
40 # last will overwrite first
43 $dir/helpers/read_defaults.sh $community > /tmp/meshwizard.tmp
46 done < /tmp/meshwizard.tmp
49 echo "++++ dnsmasq config"
50 $dir/helpers/setup_dnsmasq.sh
53 echo "++++ system config"
54 $dir/helpers/setup_system.sh
57 echo "++++ /etc/config/freifunk config"
58 $dir/helpers/setup_freifunk.sh
60 # Configure found networks
61 for net in $networks; do
63 netrenamed="${net/radio/wireless}"
66 echo "++++ Configure interface $net"
69 echo "$(msg_start $config)"
70 $dir/helpers/setup_network.sh $net
73 echo "$(msg_start $config)"
74 $dir/helpers/setup_wifi.sh $net
77 echo "$(msg_start $config)"
78 $dir/helpers/setup_olsrd.sh $net
80 net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
81 if [ "$net_dhcp" == 1 ]; then
83 echo "$(msg_start $config)"
84 $dir/helpers/setup_dhcp.sh $net
88 echo "$(msg_start $config)"
89 $dir/helpers/setup_splash.sh $net
92 echo "$(msg_start $config)"
93 $dir/helpers/setup_firewall.sh $net
95 echo " Configuration of $net finished."
98 ##### Reboot the router (because simply restarting services gave errors)