interface type for wifi adapter search
This commit is contained in:
parent
0be4226f0b
commit
cd2af02c11
|
@ -34,11 +34,13 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt"
|
||||||
# hotspot passphrase must be 5 characters or longer
|
# hotspot passphrase must be 5 characters or longer
|
||||||
HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
|
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-wifi
|
||||||
source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
|
source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
|
||||||
|
|
||||||
mesh_protocol_init
|
mesh_protocol_init
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors "${interface_type}"
|
||||||
|
|
||||||
if [ ! "$IFACE" ]; then
|
if [ ! "$IFACE" ]; then
|
||||||
echo $'No wlan adaptor'
|
echo $'No wlan adaptor'
|
||||||
|
@ -168,7 +170,7 @@ function add_wifi_interface {
|
||||||
|
|
||||||
# shellcheck disable=SC2120
|
# shellcheck disable=SC2120
|
||||||
function start {
|
function start {
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors "${interface_type}"
|
||||||
|
|
||||||
if [ -z "$IFACE" ] ; then
|
if [ -z "$IFACE" ] ; then
|
||||||
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
||||||
|
|
|
@ -100,7 +100,7 @@ function setup_wifi_atheros {
|
||||||
fi
|
fi
|
||||||
dpkg -i "$atheros_drivers_file"
|
dpkg -i "$atheros_drivers_file"
|
||||||
reset_usb_devices
|
reset_usb_devices
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors 'wlan'
|
||||||
if [ "$IFACE" ]; then
|
if [ "$IFACE" ]; then
|
||||||
wpa_action "${IFACE}" stop
|
wpa_action "${IFACE}" stop
|
||||||
wpa_cli -i "${IFACE}" terminate
|
wpa_cli -i "${IFACE}" terminate
|
||||||
|
@ -198,19 +198,24 @@ function install_atheros_wifi {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_wifi_adaptors {
|
function update_wifi_adaptors {
|
||||||
|
interface_type="$1"
|
||||||
IFACE=
|
IFACE=
|
||||||
IFACE_SECONDARY=
|
IFACE_SECONDARY=
|
||||||
|
|
||||||
|
if [ ! "$interface_type" ]; then
|
||||||
|
interface_type='wlan'
|
||||||
|
fi
|
||||||
|
|
||||||
for i in $(seq 10 -1 0); do
|
for i in $(seq 10 -1 0); do
|
||||||
ifdown --force "wlan${i}" 2> /dev/null
|
ifdown --force "${interface_type}${i}" 2> /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $(seq 10 -1 0); do
|
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
|
if [ ! $IFACE ]; then
|
||||||
IFACE="wlan${i}"
|
IFACE="wlan${i}"
|
||||||
else
|
else
|
||||||
IFACE_SECONDARY="wlan${i}"
|
IFACE_SECONDARY="${interface_type}${i}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -479,7 +484,7 @@ function wifi_networks_file_header {
|
||||||
|
|
||||||
function create_networks_interactive {
|
function create_networks_interactive {
|
||||||
remove_config_param "WIFI_INTERFACE"
|
remove_config_param "WIFI_INTERFACE"
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors 'wlan'
|
||||||
if [ ! "$IFACE" ]; then
|
if [ ! "$IFACE" ]; then
|
||||||
# Don't try to configure wifi if there are no adaptors
|
# Don't try to configure wifi if there are no adaptors
|
||||||
return
|
return
|
||||||
|
|
|
@ -150,7 +150,7 @@ if [ ! ${wifi_interface_specified} ]; then
|
||||||
else
|
else
|
||||||
sleep "${WAIT_SEC}"
|
sleep "${WAIT_SEC}"
|
||||||
fi
|
fi
|
||||||
update_wifi_adaptors
|
update_wifi_adaptors 'wlan'
|
||||||
if [ ! $IFACE ]; then
|
if [ ! $IFACE ]; then
|
||||||
echo $'No wifi adaptors were found'
|
echo $'No wifi adaptors were found'
|
||||||
exit 872356
|
exit 872356
|
||||||
|
|
Loading…
Reference in New Issue