Handle the case where `unmanaged-devices=' is empty

Fix #45
This commit is contained in:
oblique 2014-09-06 20:33:33 +03:00
parent 93d479c1eb
commit 3fe8513d9a

View File

@ -229,9 +229,10 @@ networkmanager_add_unmanaged() {
[[ -z "$MAC" ]] && return 1
fi
UNMANAGED=$(grep -m1 -Eo '^unmanaged-devices=[[:alnum:]:;,-]*' /etc/NetworkManager/NetworkManager.conf | sed 's/unmanaged-devices=//' | tr ';,' ' ')
UNMANAGED=$(grep -m1 -Eo '^unmanaged-devices=[[:alnum:]:;,-]*' /etc/NetworkManager/NetworkManager.conf)
WAS_EMPTY=0
[[ -z "$UNMANAGED" ]] && WAS_EMPTY=1
UNMANAGED=$(echo "$UNMANAGED" | sed 's/unmanaged-devices=//' | tr ';,' ' ')
for x in $UNMANAGED; do
[[ $x == "mac:${MAC}" ]] && return 2