create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap.git
Log | Files | Refs | LICENSE

commit 2dcc4070006790f139dd46e63cac2aa23df3c62e
parent ed78f36f41419fe088ff7a8760fa1cf1aadf1431
Author: oblique <psyberbits@gmail.com>
Date:   Sun Sep 21 17:57:07 +0300

Show error if udev renamed the interface

Diffstat:
create_ap | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git 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