Test if wifi is running

This commit is contained in:
Bob Mottram 2016-10-21 23:19:04 +01:00
parent 8f37e72f04
commit 4b737b40b2
3 changed files with 19 additions and 3 deletions

View File

@ -1437,8 +1437,13 @@ function wifi_settings {
cp $TEMP_WIFI_NETWORKS_FILE $WIFI_NETWORKS_FILE
rm $TEMP_WIFI_NETWORKS_FILE
${PROJECT_NAME}-wifi --networks $WIFI_NETWORKS_FILE
dialog --title $"Wifi Settings" \
--msgbox $"Wifi settings were changed" 6 40
if [[ $(wifi_is_running) == "1" ]]; then
dialog --title $"Wifi Settings" \
--msgbox $"Wifi settings were changed." 6 60
else
dialog --title $"Wifi Settings" \
--msgbox $"Wifi settings were changed. You will need to restart the system for the changes to take effect." 6 60
fi
fi
}

View File

@ -66,7 +66,9 @@ function install_final {
fi
if [ ! -f $IMAGE_PASSWORD_FILE ]; then
if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then
${PROJECT_NAME}-wifi
if [[ $(wifi_is_running) == "0" ]]; then
${PROJECT_NAME}-wifi
fi
fi
reboot
fi

View File

@ -39,6 +39,15 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
# repo for atheros AR9271 wifi driver
ATHEROS_WIFI_REPO="https://github.com/qca/open-ath9k-htc-firmware.git"
function wifi_is_running {
wifi_state=$(wpa_cli status)
if [[ "$wifi_state" == *"COMPLETED"* ]]; then
echo "1"
else
echo "0"
fi
}
function setup_wifi_atheros {
if [[ $(running_as_root) == "0" ]]; then
return