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
12 export dir="/usr/bin/meshwizard"
16 # Rename wifi interfaces
17 echo "+ Renaming wifi-devices in /etc/config/meshwizard"
18 $dir/helpers/rename-wifi.sh
20 # Firstboot/initial config
21 echo "+ Initial config"
22 $dir/helpers/initial_config.sh
25 export community=$(uci get freifunk.community.name)
26 [ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1
28 # Check whether we want to cleanup uci config before setting new options or not
29 cleanup=$(uci -q get meshwizard.general.cleanup)
31 [ "$cleanup" == 1 ] && export cleanup=1
33 # Get a list of networks we need to setup
34 networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq)
37 [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1
39 echo " Community=$community
42 # Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community,
43 # last will overwrite first
46 $dir/helpers/read_defaults.sh $community > /tmp/meshwizard.tmp
49 done < /tmp/meshwizard.tmp
51 $dir/helpers/setup_dnsmasq.sh
52 $dir/helpers/setup_system.sh
53 $dir/helpers/setup_freifunk.sh
55 # Configure found networks
56 for net in $networks; do
58 netrenamed="${net/radio/wireless}"
61 $dir/helpers/setup_network.sh $net
62 $dir/helpers/setup_wifi.sh $net
63 $dir/helpers/setup_olsrd.sh $net
65 net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp)
66 if [ "$net_dhcp" == 1 ]; then
67 $dir/helpers/setup_dhcp.sh $net
70 $dir/helpers/setup_splash.sh $net
71 $dir/helpers/setup_firewall.sh $net
74 ##### Reboot the router (because simply restarting services gave errors)