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 # Check which packages we have installed
18 opkg list_installed |
grep luci-mod-admin
> /dev
/null
&& export has_luci
=TRUE
19 export has_luci_splash
=FALSE
20 opkg list_installed |
grep luci-app-splash
> /dev
/null
&& export has_luci_splash
=TRUE
22 # Rename wifi interfaces
23 echo "+ Renaming wifi-devices in /etc/config/meshwizard"
24 $dir/helpers
/rename-wifi.sh
26 # Firstboot/initial config
27 echo "+ Initial config"
28 $dir/helpers
/initial_config.sh
31 export community
=$
(uci get freifunk.community.name
)
32 [ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1
34 # Check whether we want to cleanup uci config before setting new options or not
35 cleanup
=$
(uci
-q get meshwizard.general.cleanup
)
37 [ "$cleanup" == 1 ] && export cleanup
=1
39 # Get a list of networks we need to setup
40 networks
=$
(uci show meshwizard.netconfig |
grep -v "netconfig=" |
sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |
sort|
uniq)
43 [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1
45 echo " Community=$community
48 # Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community,
49 # last will overwrite first
52 $dir/helpers
/read_defaults.sh
$community > /tmp
/meshwizard.tmp
55 done < /tmp
/meshwizard.tmp
57 $dir/helpers
/setup_dnsmasq.sh
58 $dir/helpers
/setup_system.sh
59 $dir/helpers
/setup_freifunk.sh
61 # Configure found networks
62 for net
in $networks; do
64 netrenamed
="${net/radio/wireless}"
67 $dir/helpers
/setup_network.sh
$net
68 $dir/helpers
/setup_wifi.sh
$net
69 $dir/helpers
/setup_olsrd.sh
$net
71 net_dhcp
=$
(uci
-q get meshwizard.netconfig.
${net}_dhcp
)
72 if [ "$net_dhcp" == 1 ]; then
73 $dir/helpers
/setup_dhcp.sh
$net
76 $dir/helpers
/setup_splash.sh
$net
77 $dir/helpers
/setup_firewall.sh
$net
80 ##### Reboot the router (because simply restarting services gave errors)