Update 'root/etc/init.d/easymesh'

pull/1/head
ben 1 year ago
parent 9fbcc297c1
commit f79409dbce

@ -18,6 +18,9 @@ load_easymesh_config() {
iapp=$(uci -q get easymesh.config.iapp)
brlan=$(uci -q get network.@device[0].name)
role=$(uci -q get easymesh.config.role)
backbone=$(uci get easymesh.@easymesh[0].backbone)
apname=$(uci get easymesh.@easymesh[0].apname)
appass=$(uci get easymesh.@easymesh[0].appass)
}
ap_mode_stop() {
@ -78,6 +81,33 @@ add_wifi_mesh() {
fi
fi
if [ "$backbone" = "wifi" ]; then
# Getting the radio to configure as a client (Assuming $clientRadio is the variable for client radio)
clientRadio="radio0" # Change this to the actual variable representing the radio to configure as a client
# Check all existing wifinetX and remove if SSID matches with $apname
clientnum="${clientRadio#radio}"
clientnum=$((clientnum + 1))
while uci get wireless.wifinet$clientnum > /dev/null 2>&1; do
existing_ssid=$(uci get wireless.wifinet$clientnum.ssid 2> /dev/null)
if [ "$existing_ssid" = "$apname" ]; then
uci delete wireless.wifinet$clientnum
fi
clientnum=$((clientnum + 1))
done
# Add new WiFi client
uci set wireless.wifinet$clientnum=wifi-iface
uci set wireless.wifinet$clientnum.device=$clientRadio
uci set wireless.wifinet$clientnum.mode='sta'
uci set wireless.wifinet$clientnum.ssid=$apname
uci set wireless.wifinet$clientnum.encryption='psk2' # Or whatever encryption method is appropriate
uci set wireless.wifinet$clientnum.key=$appass
uci set wireless.wifinet$clientnum.network='wwan'
uci commit wireless
fi
if [ "$encryption" != 1 ]; then
apnum="${mesh_apRadio#radio}"
apnum=$((apnum + 1))

Loading…
Cancel
Save