#!/bin/sh

# Configuration of the bridge should be done in /etc/network/interfaces.d/bridgeX
# Read more at https://wiki.debian.org/BridgeNetworkConnections

[ ! -x /usr/sbin/brctl ] && exit 0

case "$IF_BRIDGE_PORTS" in
	"")
		exit 0
		;;

	none)
		INTERFACES=""
		;;

	all)
		INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/')
		;;

	*)
		INTERFACES="$IF_BRIDGE_PORTS"
		;;
esac

brctl delbr $IFACE

for i in $INTERFACES; do
	ip link set $i down
done
