aredn/files/etc/uci-defaults/81_aredn_migrate_wansettings

30 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
noroute=$(grep "lan_dhcp_noroute" /etc/config.mesh/_setup | sed s/^lan_dhcp_noroute\ =\ //)
olsrd_gw=$(grep "olsrd_gw" /etc/config.mesh/_setup | sed s/^olsrd_gw\ =\ //)
if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@wan[0])" != "wan" ]; then
/sbin/uci -c /etc/config.mesh -q add aredn wan
fi
if [ "${noroute}" != "" ]; then
if [ "${noroute}" = "0" ]; then
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].lan_dhcp_route=1
else
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].lan_dhcp_route=0
fi
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].lan_dhcp_defaultroute=0
/sbin/uci -c /etc/config.mesh commit aredn
sed -i /^lan_dhcp_noroute\ =/d /etc/config.mesh/_setup
elif [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@wan[0].lan_dhcp_route)" = "" ]; then
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].lan_dhcp_route=1
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].lan_dhcp_defaultroute=0
/sbin/uci -c /etc/config.mesh commit aredn
fi
if [ "${olsrd_gw}" != "" ]; then
/sbin/uci -c /etc/config.mesh set aredn.@wan[0].olsrd_gw=${olsrd_gw}
/sbin/uci -c /etc/config.mesh commit aredn
sed -i /^olsrd_gw\ =/d /etc/config.mesh/_setup
fi