|
|
@ -189,31 +189,44 @@ set_easymesh() {
|
|
|
|
add_dawn
|
|
|
|
add_dawn
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
if [ "$ap_mode" = 1 ]; then
|
|
|
|
|
|
|
|
#backup wireless
|
|
|
|
|
|
|
|
cp /etc/config/wireless /etc/config/wireless.backup
|
|
|
|
|
|
|
|
#backup network
|
|
|
|
|
|
|
|
cp /etc/config/network /etc/config/network.backup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# these services do not run on dumb APs
|
|
|
|
|
|
|
|
for i in firewall dnsmasq odhcpd; do
|
|
|
|
|
|
|
|
if /etc/init.d/"$i" enabled; then
|
|
|
|
|
|
|
|
/etc/init.d/"$i" disable
|
|
|
|
|
|
|
|
/etc/init.d/"$i" stop
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Now switch the lan interface to DHCP client
|
|
|
|
|
|
|
|
echo switching the lan interface to DHCP client
|
|
|
|
uci set network.lan.proto='dhcp'
|
|
|
|
uci set network.lan.proto='dhcp'
|
|
|
|
|
|
|
|
uci delete network.wan
|
|
|
|
|
|
|
|
uci delete network.wan6
|
|
|
|
uci delete network.lan.ipaddr
|
|
|
|
uci delete network.lan.ipaddr
|
|
|
|
uci delete network.lan.netmask
|
|
|
|
uci delete network.lan.netmask
|
|
|
|
uci delete network.lan.gateway
|
|
|
|
|
|
|
|
uci -q delete network.lan.dns
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uci add_list network.lan.dns=$gateway # assuming gateway IP is the DNS server
|
|
|
|
# change the host name to easymesh node
|
|
|
|
uci add_list network.lan.gateway=$gateway # set gateway as the DHCP server
|
|
|
|
echo changing the hostname to easymesh
|
|
|
|
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
|
|
|
|
|
|
|
|
uci add_list network.lan.ifname='bat0' # add bat0 to LAN interface list
|
|
|
|
|
|
|
|
uci commit network
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "" > /etc/easymesh
|
|
|
|
# commit all changes
|
|
|
|
|
|
|
|
|
|
|
|
uci set dhcp.lan.ignore='1' # ignore interface for serving DHCP
|
|
|
|
uci commit
|
|
|
|
uci -q delete dhcp.lan.ra
|
|
|
|
|
|
|
|
uci -q delete dhcp.lan.dhcpv6
|
|
|
|
# remove the firewall config
|
|
|
|
uci -q delete dhcp.lan.ra_management
|
|
|
|
echo removing firewall config
|
|
|
|
uci commit dhcp
|
|
|
|
mv /etc/config/firewall /etc/config/firewall.restore
|
|
|
|
|
|
|
|
|
|
|
|
/etc/init.d/odhcpd stop && /etc/init.d/odhcpd disable
|
|
|
|
# reboot the device
|
|
|
|
/etc/init.d/dnsmasq restart # Restarting dnsmasq to apply DHCP client settings
|
|
|
|
|
|
|
|
/etc/init.d/network reload # Reloading network to apply the new network settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/etc/init.d/firewall stop && /etc/init.d/firewall disable >/dev/null 2>&1
|
|
|
|
reboot
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|