WIP commit

main
Jason Hawks 1 year ago
parent 743d6cb3ab
commit 4833e5a138

@ -215,7 +215,7 @@ o:depends({ipmode="static",role="off"})
btnAPMode = s:taboption("apmode", Button, "_btn_apmode", translate("Enable Dumb AP Mode"), translate("WARNING: THIS WILL CHANGE THIS NODE'S IP ADDRESS, YOU WILL LOOSE ACCESS TO THIS UI"))
function btnAPMode.write()
luci.sys.call("/easymesh/dumbap.sh")
luci.sys.call("/easymesh/easymesh.sh dumbap &")
end
btnAPMode:depends("role", "off")

@ -26,18 +26,29 @@ set_apmode() {
fi
done
if [ $(uci -q get easymesh.config.ipmode) == "static" ]; then
# Set static IP
uci set network.lan.proto='static'
uci set network.lan.ipaddr=$(uci -q get easymesh.config.ipaddr)
uci set network.lan.netmask=$(uci -q get easymesh.config.netmask)
uci set network.lan.gateway=$(uci -q get easymesh.config.gatewayIP)
uci set network.lan.dns='1.1.1.1'
else
# Set LAN interface to DHCP client
uci del network.lan.ipaddr
uci del network.lan.netmask
uci set network.lan.proto='dhcp'
fi
# Delete wan interfaces
uci del network.wan
uci del network.wan6
# Fix firewall to be disabled
# Set firewall disabled
uci del firewall.lan.network
uci del firewall.wan.network
# Fix dhcp to be disabled
# Just in case, set lan to be ignored by dhcp
uci set dhcp.lan.ignore='1'
uci del dhcp.wan
@ -60,6 +71,31 @@ set_apmode() {
# Get the radio to be used for mesh from the config
AP_RADIO=$(uci -q get easymesh.config.apRadio)
# Our config set mesh_id that we are looking for
MESH_ID=$(uci -q get easymesh.config.mesh_id)
# Check if MESH_NAME and AP_RADIO are set, if so find set our network
if [ ! -z "$AP_RADIO" ] || [ ! -z "$MESH_ID" ]; then
# Get the output from uci show wireless
uci_output=$(uci show wireless)
# Find the wireless network with the matching ssid and delete it
ssid=$(echo "$uci_output" | grep -o "wireless\.wifinet[0-9]*\.ssid='$MESH_ID'")
if [ ! -z "$ssid" ]; then
# Loop through radios and delete the wireless networks
for radio in $AP_RADIO; do
# Get the number from the radio name
radio_num="${radio#radio}"
# Delete the network
#uci del wireless.wifinet$radio_num
echo "Found wireless network with ssid '$MESH_NAME' on radio$radio_num"
done
fi
fi
# # Loop through the selected radios
# for CURRENT_RADIO in $AP_RADIO; do
# echo "Multiple Radio Setup, Current Radio: $CURRENT_RADIO"

Loading…
Cancel
Save