diff --git a/src/freedombone-mesh-batman b/src/freedombone-mesh-batman index 1dd8730c..7b8b40f5 100755 --- a/src/freedombone-mesh-batman +++ b/src/freedombone-mesh-batman @@ -34,11 +34,13 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt" # hotspot passphrase must be 5 characters or longer HOTSPOT_PASSPHRASE="${PROJECT_NAME}" +interface_type='wlan' + source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh mesh_protocol_init -update_wifi_adaptors +update_wifi_adaptors "${interface_type}" if [ ! "$IFACE" ]; then echo $'No wlan adaptor' @@ -168,7 +170,7 @@ function add_wifi_interface { # shellcheck disable=SC2120 function start { - update_wifi_adaptors + update_wifi_adaptors "${interface_type}" if [ -z "$IFACE" ] ; then echo 'error: unable to find wifi interface, not enabling batman-adv mesh' diff --git a/src/freedombone-utils-wifi b/src/freedombone-utils-wifi index 663bf8b9..e140028d 100755 --- a/src/freedombone-utils-wifi +++ b/src/freedombone-utils-wifi @@ -100,7 +100,7 @@ function setup_wifi_atheros { fi dpkg -i "$atheros_drivers_file" reset_usb_devices - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ "$IFACE" ]; then wpa_action "${IFACE}" stop wpa_cli -i "${IFACE}" terminate @@ -198,19 +198,24 @@ function install_atheros_wifi { } function update_wifi_adaptors { + interface_type="$1" IFACE= IFACE_SECONDARY= + if [ ! "$interface_type" ]; then + interface_type='wlan' + fi + for i in $(seq 10 -1 0); do - ifdown --force "wlan${i}" 2> /dev/null + ifdown --force "${interface_type}${i}" 2> /dev/null done for i in $(seq 10 -1 0); do - if grep -q "wlan${i}" /proc/net/dev; then + if grep -q "${interface_type}${i}" /proc/net/dev; then if [ ! $IFACE ]; then IFACE="wlan${i}" else - IFACE_SECONDARY="wlan${i}" + IFACE_SECONDARY="${interface_type}${i}" return fi fi @@ -479,7 +484,7 @@ function wifi_networks_file_header { function create_networks_interactive { remove_config_param "WIFI_INTERFACE" - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ ! "$IFACE" ]; then # Don't try to configure wifi if there are no adaptors return diff --git a/src/freedombone-wifi b/src/freedombone-wifi index c154f49a..da673c7b 100755 --- a/src/freedombone-wifi +++ b/src/freedombone-wifi @@ -150,7 +150,7 @@ if [ ! ${wifi_interface_specified} ]; then else sleep "${WAIT_SEC}" fi - update_wifi_adaptors + update_wifi_adaptors 'wlan' if [ ! $IFACE ]; then echo $'No wifi adaptors were found' exit 872356