Jason and Riley's cleanup

pull/2/head
Jason Hawks 11 months ago
parent b4d96ce8d3
commit 2bc33a566f

@ -10,7 +10,7 @@ load_easymesh_config() {
gateway=$(uci -q get easymesh.config.gateway)
dns=$(uci -q get easymesh.config.dns)
ap_ipaddr=$(uci -q get network.lan.ipaddr)
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
#ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
apRadio=$(uci -q get easymesh.config.apRadio)
kvr=$(uci -q get easymesh.config.kvr)
iapp=$(uci -q get easymesh.config.iapp)
@ -23,25 +23,34 @@ load_easymesh_config() {
printf "enable: $enable\nmesh_bat0: $mesh_bat0\nap_mode: $ap_mode\nlan: $lan\nipaddr: $ipaddr\nnetmask: $netmask\ngateway: $gateway\ndns: $dns\nap_ipaddr: $ap_ipaddr\nap_ipaddr1: $ap_ipaddr1\napRadio: $apRadio\nkvr: $kvr\niapp: $iapp\nbrlan: $brlan\nrole: $role\nbackbone: $backbone\napname: $apname\nappass: $appass" > /root/.easymesh
}
ap_mode_stop() {
ap_ipaddr=$(uci -q get network.lan.ipaddr)
ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
uci -q delete network.lan.gateway
uci -q del_list network.lan.dns=$dns1
uci commit network
stop_node() {
cp /etc/config/wireless.meshbak /etc/config/wireless
cp /etc/config/network.meshbak /etc/config/network
cp /etc/config/dhcp.meshbak /etc/config/dhcp
echo "" >/etc/easymesh
/etc/init.d/network restart
/etc/init.d/system reload
}
uci -q delete dhcp.lan.dynamicdhcp
uci -q delete dhcp.lan.ignore
uci commit dhcp
# ap_mode_stop() {
# ap_ipaddr=$(uci -q get network.lan.ipaddr)
# ap_ipaddr1=$(sed -n '1p' /etc/easymesh 2>/dev/null)
# dns1=$(sed -n '2p' /etc/easymesh 2>/dev/null)
# if [ "$ap_ipaddr" = "$ap_ipaddr1" ]; then
# uci -q delete network.lan.gateway
# uci -q del_list network.lan.dns=$dns1
# uci commit network
/etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
/etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
fi
}
# echo "" >/etc/easymesh
# uci -q delete dhcp.lan.dynamicdhcp
# uci -q delete dhcp.lan.ignore
# uci commit dhcp
# /etc/init.d/odhcpd enable && /etc/init.d/odhcpd start
# /etc/init.d/firewall enable && /etc/init.d/firewall start >/dev/null 2>&1
# fi
# }
add_wifi_mesh() {
mesh_nwi_mesh=$(uci -q get network.nwi_mesh_${apall})
@ -274,9 +283,9 @@ set_easymesh() {
if [ "$ap_mode" = 1 ]; then
# Backup Configurations if your scared
cp /etc/config/wireless /etc/config/wireless.backup
cp /etc/config/network /etc/config/network.backup
cp /etc/config/dhcp /etc/config/dhcp.backup
cp /etc/config/wireless /etc/config/wireless.meshbak
cp /etc/config/network /etc/config/network.meshbak
cp /etc/config/dhcp /etc/config/dhcp.meshbak
# Generate a random IP in the same subnet for fun
ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP
@ -302,8 +311,9 @@ set_easymesh() {
uci delete network.lan.netmask
# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
uci set network.lan.netmask=$netmask
uci set network.lan.gateway=$dns
# Comment out because we want to pull this from dhcp
# uci set network.lan.netmask=$netmask
# uci set network.lan.gateway=$dns
uci set system.@system[0].hostname=$gateway
# Configure LAN bridge and add ethernet interfaces to the bridge
@ -319,11 +329,7 @@ set_easymesh() {
uci set wireless.default_$apall.network='lan' # Make sure the Wi-Fi is part of the lan network
# Commit all changes
uci commit network
uci commit system
# In case of separate wireless config, commit that too
uci commit wireless
uci commit
# Restart the network to apply changes
/etc/init.d/network restart
@ -337,9 +343,12 @@ set_easymesh() {
mv /etc/config/firewall /etc/config/firewall.unused
else
ap_mode_stop
stop_node
fi # end if [ "$ap_mode" = 1 ]
else
# Disable the ap_mode settings
stop_node
if [ "$mesh_bat0" = "interface" ]; then
uci -q delete network.bat0
if [ "$brlan" = "br-lan" ]; then
@ -366,10 +375,6 @@ set_easymesh() {
done
fi
if [ "$ap_mode" = 0 ]; then
ap_mode_stop
fi
/etc/init.d/network restart
} # end set_easymesh()

Loading…
Cancel
Save