32e37f2492
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/vmware@1952 6952d904-891a-0410-993b-d76249ca496b
23 lines
554 B
Bash
23 lines
554 B
Bash
#!/bin/sh
|
|
|
|
if [ -x /sbin/brctl ]; then
|
|
BRCTL="/sbin/brctl"
|
|
elif [ -x /usr/sbin/brctl ]; then
|
|
BRCTL="/usr/sbin/brctl"
|
|
else
|
|
echo "no bridge utils installed"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -x /sbin/ip ]; then
|
|
switch=( $(/sbin/ip route list | awk '/^default / { sub(/.* dev /, ""); print $1 }') )
|
|
/sbin/ip link set $1 up
|
|
else
|
|
switch=( $(/bin/netstat -rn | awk '/^0\.0\.0\.0/ { print $NF }') )
|
|
/sbin/ifconfig $1 0.0.0.0 up
|
|
fi
|
|
|
|
[[ ${switch#} -ne "1" ]] && logger -t qemu "$0 found more than one bridge connecting $1 to ${switch}"
|
|
${BRCTL} addif ${switch} $1
|
|
|