# 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
-. /etc/functions.sh
+. /lib/functions.sh
echo "
-/* Meshwizard 0.0.5 */
+/* Meshwizard 0.0.8 */
"
# config
export dir="/usr/bin/meshwizard"
. $dir/functions.sh
+[ -f /proc/net/ipv6_route ] && has_ipv6=1
# Check which packages we have installed
export has_luci=FALSE
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"
+echo $community
# 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)
$dir/helpers/setup_olsrd.sh
$dir/helpers/setup_firewall.sh
+if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
+ $dir/helpers/setup_wan_static.sh
+fi
+
+if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask" ]; then
+ $dir/helpers/setup_lan_static.sh
+fi
+
+if [ "$profile_ipv6" == 1 ] && [ "$has_ipv6" = 1 ]; then
+ $dir/helpers/setup_lan_ipv6.sh
+ # Setup auto-ipv6
+ if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; 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
$dir/helpers/setup_network.sh $net
- if [ ! "$net" == "wan" ]; then
+ if [ ! "$net" == "wan" ] && [ ! "$net" == "lan" ]; then
$dir/helpers/setup_wifi.sh $net
fi
$dir/helpers/setup_olsrd_interface.sh $net
$dir/helpers/setup_splash.sh $net
$dir/helpers/setup_firewall_interface.sh $net
+
+ if [ "$profile_ipv6" == 1 ] && [ "$has_ipv6" = 1 ]; then
+ $dir/helpers/setup_radvd_interface.sh $net
+ fi
done
##### Reboot the router (because simply restarting services gave errors)
-#reboot
+echo "+ The wizard has finished and the router will reboot now."
+
+reboot