interface type for wifi adapter search

This commit is contained in:
Bob Mottram 2018-03-07 15:09:31 +00:00
parent 0be4226f0b
commit cd2af02c11
3 changed files with 15 additions and 8 deletions

View File

@ -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'

View File

@ -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

View File

@ -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