diff --git a/i386-dm/hookstarget.mak b/i386-dm/hookstarget.mak index cf4b39e..0aa6756 100644 --- a/i386-dm/hookstarget.mak +++ b/i386-dm/hookstarget.mak @@ -3,3 +3,5 @@ install-hook: $(INSTALL_DIR) "$(DESTDIR)/$(bindir)" $(INSTALL_DIR) "$(DESTDIR)/$(configdir)" $(INSTALL_PROG) qemu-ifup "$(DESTDIR)/$(configdir)/" + $(INSTALL_PROG) qemu-ifup-Linux "$(DESTDIR)/$(configdir)/" + $(INSTALL_PROG) qemu-ifup-NetBSD "$(DESTDIR)/$(configdir)/" diff --git a/i386-dm/qemu-ifup b/i386-dm/qemu-ifup index bcbee92..0cd2840 100644 --- a/i386-dm/qemu-ifup +++ b/i386-dm/qemu-ifup @@ -1,37 +1,5 @@ #!/bin/sh -#. /etc/rc.d/init.d/functions -#ulimit -c unlimited - -echo 'config qemu network with xen bridge for ' $* - -bridge=$2 - -# -# Old style bridge setup with netloop, used to have a bridge name -# of xenbrX, enslaving pethX and vif0.X, and then configuring -# eth0. -# -# New style bridge setup does not use netloop, so the bridge name -# is ethX and the physical device is enslaved pethX -# -# So if... -# -# - User asks for xenbrX -# - AND xenbrX doesn't exist -# - AND there is a ethX device which is a bridge -# -# ..then we translate xenbrX to ethX -# -# This lets old config files work without modification -# -if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ] -then - if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ] - then - bridge="eth${bridge#xenbr}" - fi -fi - -ifconfig $1 0.0.0.0 up -brctl addif $bridge $1 || true +PROG=$0 +OS=`uname -s` +exec ${PROG}-${OS} $@ diff --git a/i386-dm/qemu-ifup-Linux b/i386-dm/qemu-ifup-Linux new file mode 100644 index 0000000..bcbee92 --- /dev/null +++ b/i386-dm/qemu-ifup-Linux @@ -0,0 +1,37 @@ +#!/bin/sh + +#. /etc/rc.d/init.d/functions +#ulimit -c unlimited + +echo 'config qemu network with xen bridge for ' $* + +bridge=$2 + +# +# Old style bridge setup with netloop, used to have a bridge name +# of xenbrX, enslaving pethX and vif0.X, and then configuring +# eth0. +# +# New style bridge setup does not use netloop, so the bridge name +# is ethX and the physical device is enslaved pethX +# +# So if... +# +# - User asks for xenbrX +# - AND xenbrX doesn't exist +# - AND there is a ethX device which is a bridge +# +# ..then we translate xenbrX to ethX +# +# This lets old config files work without modification +# +if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ] +then + if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ] + then + bridge="eth${bridge#xenbr}" + fi +fi + +ifconfig $1 0.0.0.0 up +brctl addif $bridge $1 || true diff --git a/i386-dm/qemu-ifup-NetBSD b/i386-dm/qemu-ifup-NetBSD new file mode 100644 index 0000000..eee7876 --- /dev/null +++ b/i386-dm/qemu-ifup-NetBSD @@ -0,0 +1,3 @@ +#!/bin/sh +ifconfig $1 up +exec /sbin/brconfig $2 add $1