From 4dd28e782446cb5101be9cb1ce5eb3d4df4003e3 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 24 May 2013 16:02:20 +0200 Subject: [PATCH] grml-sniff: make sure network devices configured as BRIDGE_DEVICES exist --- sbin/grml-sniff | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sbin/grml-sniff b/sbin/grml-sniff index 3722c6a..cf41833 100755 --- a/sbin/grml-sniff +++ b/sbin/grml-sniff @@ -32,6 +32,17 @@ fi [ -n "$BRIDGE_NAME" ] || BRIDGE_NAME='br0' [ -n "$BRIDGE_DEVICES" ] || BRIDGE_DEVICES='eth0 eth1' +check_devs() { + for dev in $BRIDGE_DEVICES ; do + ip link show dev "$dev" >/dev/null 2>&1 || return 1 + done +} + +if ! check_devs ; then + eerror "BRIDGE_DEVICES $BRIDGE_DEVICES do not seem to exist." >&2 + exit 1 +fi + check4progs $BRCTL || exit 1 case "$1" in -- 2.1.4