|
|
@ -65,7 +65,6 @@ clear_mesh_radio() {
|
|
|
|
# Commit changes to make sure the wireless configuration is updated
|
|
|
|
# Commit changes to make sure the wireless configuration is updated
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
# Restart wireless to apply changes
|
|
|
|
# Restart wireless to apply changes
|
|
|
|
wifi reload
|
|
|
|
|
|
|
|
wifi up
|
|
|
|
wifi up
|
|
|
|
echo "Wireless interfaces reloaded."
|
|
|
|
echo "Wireless interfaces reloaded."
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -292,7 +291,6 @@ restart_and_reload() {
|
|
|
|
uci commit wireless
|
|
|
|
uci commit wireless
|
|
|
|
|
|
|
|
|
|
|
|
# Reload wifi to apply changes without restarting all interfaces
|
|
|
|
# Reload wifi to apply changes without restarting all interfaces
|
|
|
|
wifi reload
|
|
|
|
|
|
|
|
wifi up
|
|
|
|
wifi up
|
|
|
|
echo "Wireless interfaces reloaded."
|
|
|
|
echo "Wireless interfaces reloaded."
|
|
|
|
|
|
|
|
|
|
|
@ -361,7 +359,7 @@ set_apmode() {
|
|
|
|
uci del dhcp.wan
|
|
|
|
uci del dhcp.wan
|
|
|
|
|
|
|
|
|
|
|
|
# Fix this for proper variable name
|
|
|
|
# Fix this for proper variable name
|
|
|
|
HOSTNAME=$(uci -q get easymesh.config.gateway)
|
|
|
|
HOSTNAME=$(uci -q get easymesh.config.hostname)
|
|
|
|
# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
|
|
|
|
# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
|
|
|
|
uci set system.@system[0].hostname=$HOSTNAME
|
|
|
|
uci set system.@system[0].hostname=$HOSTNAME
|
|
|
|
|
|
|
|
|
|
|
@ -388,13 +386,13 @@ set_apmode() {
|
|
|
|
RADIO_LIST=$AP_RADIO
|
|
|
|
RADIO_LIST=$AP_RADIO
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Loop through the selected radios
|
|
|
|
# # Loop through the selected radios
|
|
|
|
for CURRENT_RADIO in $RADIO_LIST; do
|
|
|
|
# for CURRENT_RADIO in $RADIO_LIST; do
|
|
|
|
echo "Multiple Radio Setup, Current Radio: $CURRENT_RADIO"
|
|
|
|
# echo "Multiple Radio Setup, Current Radio: $CURRENT_RADIO"
|
|
|
|
# Extact the radio number from the radio name
|
|
|
|
# # Extact the radio number from the radio name
|
|
|
|
wifi_num="${cur_radio#CURRENT_RADIO}"
|
|
|
|
# wifi_num="${cur_radio#CURRENT_RADIO}"
|
|
|
|
uci set wireless.wifinet${wifi_num}.network="lan nwi_mesh_${cur_radio}"
|
|
|
|
# uci set wireless.wifinet${wifi_num}.network="lan private_router_batman"
|
|
|
|
done
|
|
|
|
# done
|
|
|
|
|
|
|
|
|
|
|
|
uci commit
|
|
|
|
uci commit
|
|
|
|
# Tell openwrt to reload the configs
|
|
|
|
# Tell openwrt to reload the configs
|
|
|
@ -434,20 +432,22 @@ set_apmode() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# We accept the parameters: start, stop and apmode
|
|
|
|
# Enable easymesh
|
|
|
|
# start: Enables easymesh
|
|
|
|
enable_easymesh() {
|
|
|
|
# stop: Disables easymesh
|
|
|
|
|
|
|
|
# apmode: Sets the device to AP mode
|
|
|
|
|
|
|
|
if [ "$1" = "start" ]; then
|
|
|
|
|
|
|
|
clear_mesh_radio
|
|
|
|
clear_mesh_radio
|
|
|
|
create_batman_network
|
|
|
|
create_batman_network
|
|
|
|
process_radios
|
|
|
|
process_radios
|
|
|
|
restart_and_reload
|
|
|
|
restart_and_reload
|
|
|
|
elif [ "$1" = "stop" ]; then
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Disable easymesh
|
|
|
|
|
|
|
|
disable_easymesh() {
|
|
|
|
clear_mesh_radio
|
|
|
|
clear_mesh_radio
|
|
|
|
disable_batman_interfaces
|
|
|
|
disable_batman_interfaces
|
|
|
|
# elif [ "$1" = "apmode" ]; then
|
|
|
|
}
|
|
|
|
# set_apmode
|
|
|
|
|
|
|
|
else
|
|
|
|
# Check if enabled
|
|
|
|
echo "Invalid parameter passed."
|
|
|
|
if [ "$(uci -q get easymesh.config.enabled)" = 0 ]; then
|
|
|
|
|
|
|
|
echo "Easymesh is disabled, exiting."
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|