From c5ecd31709a2cd8e5c62c5a6d7ab9083c0538442 Mon Sep 17 00:00:00 2001 From: toby Date: Mon, 22 Apr 2019 23:56:23 +0000 Subject: [PATCH] nicer output on ifdown... being anal --- files/qemu-ifdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/qemu-ifdown b/files/qemu-ifdown index 6be47b0..beca916 100755 --- a/files/qemu-ifdown +++ b/files/qemu-ifdown @@ -23,9 +23,9 @@ if [ ! -z $BRIDGE ]; then BRIDGE=${BRIDGE##*/} echo "removing $IFACE from $BRIDGE" brctl delif $BRIDGE $IFACE - if ! ls /sys/devices/virtual/net/$BRIDGE/brif/ | grep -qv "vxlan\|vlan"; then #if so is the *local* bridge now empty? if so, nuke the whole bridge including tunnel endpoint + if ! ls /sys/devices/virtual/net/$BRIDGE/brif/ | grep -qv "vxlan\|vlan" 2>/dev/null; then #if so is the *local* bridge now empty? if so, nuke the whole bridge including tunnel endpoint echo "removing unused bridge: $BRIDGE" - for uplinkif in ls /sys/devices/virtual/net/$BRIDGE/brif/; do + for uplinkif in $(ls /sys/devices/virtual/net/$BRIDGE/brif/ 2>/dev/null); do ip link del dev $uplinkif done ip link set down $BRIDGE