[arch-projects] [netctl][PATCH] Catch connection failures from wifi-menu
Wireless connections yield before the password is checked, so it is better to wait for a connection to come online before concluding the generated profile works. --- src/netctl.in | 11 +++++++---- src/wifi-menu | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/netctl.in b/src/netctl.in index 3a96f12..c5f3cb7 100644 --- a/src/netctl.in +++ b/src/netctl.in @@ -129,10 +129,13 @@ unit_reenable() { wait_online() { local profile="$1" - if sd_call "is-active --quiet" "$profile"; then - timeout_wait "${TIMEOUT_ONLINE:-120}" \ - '[[ $(sd_status_text "$profile") == "online" ]]' - else + if ! timeout_wait "${TIMEOUT_ONLINE:-120}" \ + '! sd_call "is-active --quiet" "$profile" || \ + [[ $(sd_status_text "$profile") == "online" ]]'; then + report_notice "timeout" + return 1 + elif ! sd_call "is-active --quiet" "$profile"; then + report_notice "failed" return 1 fi } diff --git a/src/wifi-menu b/src/wifi-menu index f2030ae..21752ea 100755 --- a/src/wifi-menu +++ b/src/wifi-menu @@ -196,7 +196,7 @@ connect_to_ssid() { do_debug systemctl restart "netctl-auto@$INTERFACE.service" fi do_debug netctl-auto switch-to "$PROFILE" - elif ! netctl switch-to "$PROFILE"; then + elif ! netctl switch-to "$PROFILE" || ! netctl wait-online "$PROFILE"; then if is_yes "${NEW_PROFILE:-no}"; then msg=" CONNECTING FAILED -- 2.34.1
participants (1)
-
Jouke Witteveen