mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
qemu-boot.sh: Replace deprecated brctl by iproute2 (ip)
/sbin/brctl is not part of openSUSE anymore, use ip link commands instead. Also, remove the vlan option, now unsupported by qemu. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8e7ceb6444
commit
a0842c6297
1 changed files with 12 additions and 20 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
goodbye()
|
goodbye()
|
||||||
{
|
{
|
||||||
:
|
:
|
||||||
rm -f $tmp_files
|
rm -rf $tmp_files
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
|
|
@ -89,8 +89,8 @@ boot_net()
|
||||||
|
|
||||||
do_sudo -E /usr/bin/$qemu_exe \
|
do_sudo -E /usr/bin/$qemu_exe \
|
||||||
-boot n \
|
-boot n \
|
||||||
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
-net tap,ifname=tap0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
||||||
-net nic,vlan=0$nic_model$macaddr \
|
-net nic$nic_model$macaddr \
|
||||||
"$qemu_opts"
|
"$qemu_opts"
|
||||||
|
|
||||||
# invalid param macaddr
|
# invalid param macaddr
|
||||||
|
|
@ -116,7 +116,7 @@ boot_image()
|
||||||
#-net tap,ifname=tap1,vlan=1,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
#-net tap,ifname=tap1,vlan=1,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
||||||
#set -x
|
#set -x
|
||||||
do_sudo -E /usr/bin/$qemu_exe \
|
do_sudo -E /usr/bin/$qemu_exe \
|
||||||
-net nic,vlan=0$nic_model$macaddr \
|
-net nic,$nic_model$macaddr \
|
||||||
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
|
||||||
"$qemu_opts" \
|
"$qemu_opts" \
|
||||||
-drive file=$boot_image
|
-drive file=$boot_image
|
||||||
|
|
@ -134,7 +134,8 @@ boot()
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
net)
|
net)
|
||||||
boot_net
|
shift
|
||||||
|
boot_net "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
boot_image "$@"
|
boot_image "$@"
|
||||||
|
|
@ -156,7 +157,7 @@ macaddr=,macaddr=00:0B:DC:9B:D6:DA
|
||||||
base=dc=priv,dc=lcl
|
base=dc=priv,dc=lcl
|
||||||
qemu_exe=qemu-kvm
|
qemu_exe=qemu-kvm
|
||||||
qemu_opts=""
|
qemu_opts=""
|
||||||
brctl=`PATH=/usr/sbin:/sbin /usr/bin/which brctl`
|
ip=`PATH=/usr/sbin:/sbin:/usr/bin /usr/bin/which ip`
|
||||||
#nic_model=",model=rtl8139"
|
#nic_model=",model=rtl8139"
|
||||||
tmp_files=""
|
tmp_files=""
|
||||||
tmpdir=""
|
tmpdir=""
|
||||||
|
|
@ -196,25 +197,16 @@ shift $(($OPTIND - 1))
|
||||||
|
|
||||||
case $myname in
|
case $myname in
|
||||||
*ifup*)
|
*ifup*)
|
||||||
#set -x
|
|
||||||
#[ "$1" = tap1 ] || exit 0
|
|
||||||
#do_sudo /sbin/ifconfig tap1 up
|
|
||||||
#do_sudo $brctl addif in1 tap0
|
|
||||||
#do_sudo /sbin/ifconfig tap0 up
|
|
||||||
#do_sudo $brctl addif in2 tap1
|
|
||||||
#exit 0
|
|
||||||
|
|
||||||
virt_if=$1
|
virt_if=$1
|
||||||
touch /tmp/i-ran-$myname
|
touch /tmp/i-ran-$myname
|
||||||
do_sudo /sbin/ifconfig $virt_if up
|
do_sudo $ip link set $virt_if up
|
||||||
# this is most certainly always priv0
|
do_sudo $ip link set dev $virt_if master $bridge
|
||||||
do_sudo $brctl addif $bridge $virt_if
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*ifdown*)
|
*ifdown*)
|
||||||
# this is most certainly always priv0
|
virt_if=$1
|
||||||
do_sudo $brctl delif $bridge $1
|
do_sudo $ip link set dev $virt_if nomaster
|
||||||
do_sudo /sbin/ifconfig $1 down
|
do_sudo $ip link set dev $virt_if down
|
||||||
;;
|
;;
|
||||||
qemu.sh)
|
qemu.sh)
|
||||||
boot "$@"
|
boot "$@"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue