From 2dcc4070006790f139dd46e63cac2aa23df3c62e Mon Sep 17 00:00:00 2001 From: oblique Date: Sun, 21 Sep 2014 17:57:07 +0300 Subject: [PATCH] Show error if udev renamed the interface --- create_ap | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/create_ap b/create_ap index 19b2473..36ba067 100755 --- a/create_ap +++ b/create_ap @@ -233,7 +233,8 @@ networkmanager_is_running() { } networkmanager_iface_is_unmanaged() { - nmcli -t -f DEVICE,STATE d | grep -E "^$1:unmanaged$" > /dev/null 2>&1 + is_interface "$1" || return 2 + (nmcli -t -f DEVICE,STATE d | grep -E "^$1:unmanaged$" > /dev/null 2>&1) || return 1 } ADDED_UNMANAGED= @@ -326,7 +327,12 @@ networkmanager_rm_unmanaged_if_needed() { networkmanager_wait_until_unmanaged() { networkmanager_is_running || return 1 - while ! networkmanager_iface_is_unmanaged "$1"; do + while :; do + networkmanager_iface_is_unmanaged "$1" + RES=$? + [[ $RES -eq 0 ]] && break + [[ $RES -eq 2 ]] && die "Interface '${1}' does not exists. + It's probably renamed by a udev rule." sleep 1 done sleep 2