commit 947c9e5f591c0a3135d5055db4d64a23418bc3dc
parent 1826234e7cc00ed0e16d5cf9bca74b3ba06ac6a8
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Mon, 22 Feb 2016 12:57:59 +0100
Fixes for inteface renaming
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/zsh-functions/confz_ip_init b/zsh-functions/confz_ip_init
@@ -9,18 +9,16 @@ confz_rename_interface_check() {
checkvars name mac
# local -A ifaces
- local ignored iface mac rest out ok old_name
+ local ignored iface mac rest out old_name
out=$( confz_do ip link show ) || die "ip failed"
- ok=0
while read ignored iface rest; do
read ignored mac rest
if [[ ${iface%:} == $vars[name] ]]; then
[[ $mac == $vars[mac] ]] || \
die "${(qqq)iface%:} already exists with different MAC address"
- ok=1
- break
+ return 0
fi
if [[ -z $old_name && $mac == $vars[mac] ]]; then
old_name=${iface%:}
@@ -30,5 +28,5 @@ confz_rename_interface_check() {
[[ -n $old_name ]] || die "could not find interface with MAC: $vars[mac]"
do_command=( ip link set dev $old_name name $vars[name] )
- (($ok))
+ return 1
}