hilfe mein git ist komisch
This commit is contained in:
41
etc/qemu-ifup
Executable file
41
etc/qemu-ifup
Executable file
@@ -0,0 +1,41 @@
|
||||
#! /bin/sh
|
||||
# Script to bring a network (tap) device for qemu up.
|
||||
# The idea is to add the tap device to the same bridge
|
||||
# as we have default routing to.
|
||||
|
||||
# in order to be able to find brctl
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
ip=$(command -v ip)
|
||||
|
||||
if [ -n "$ip" ]; then
|
||||
ip link set "$1" up
|
||||
else
|
||||
brctl=$(command -v brctl)
|
||||
if [ -z "$ip$brctl" ]; then
|
||||
echo "W: $0: not doing any bridge processing: neither ip nor brctl utility not found" >&2
|
||||
exit 0
|
||||
fi
|
||||
ifconfig "$1" 0.0.0.0 up
|
||||
fi
|
||||
|
||||
switch=$(ip route ls | \
|
||||
awk '/^default / {
|
||||
for(i=0;i<NF;i++) { if ($i == "dev") { print $(i+1); next; } }
|
||||
}'
|
||||
)
|
||||
|
||||
# only add the interface to default-route bridge if we
|
||||
# have such interface (with default route) and if that
|
||||
# interface is actually a bridge.
|
||||
# It is possible to have several default routes too
|
||||
for br in $switch; do
|
||||
if [ -d /sys/class/net/$br/bridge/. ]; then
|
||||
if [ -n "$ip" ]; then
|
||||
exec ip link set "$1" master "$br"
|
||||
else
|
||||
exec brctl addif $br "$1"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "W: $0: no bridge for guest interface found" >&2
|
||||
Reference in New Issue
Block a user