Fix disk creation bug.
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Mon, 12 Jun 2023 07:47:11 +0000 (17:47 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Mon, 12 Jun 2023 07:47:11 +0000 (17:47 +1000)
Add vde network option via NET=vde

vm.sh

diff --git a/vm.sh b/vm.sh
index f6304aa4dcaa4e9d59460c2a5aa4dc0063bbf395..41f024dae052cdbfd702b031fe4ce3b828ce893f 100755 (executable)
--- a/vm.sh
+++ b/vm.sh
@@ -19,8 +19,18 @@ else
        DISK2="-drive index=1,id=boot,media=disk,format=raw,file=tiniest.iso"
     fi
 fi 
-    
-[ -d disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
+
+case "$NET" in
+    vde)
+       #NET="-net nic,macaddr=06:7f:57:5e:c8:92 -net vde,sock=/run/vde.ctl"
+       NET="-net nic,model=e1000 -net vde,sock=/run/vde.ctl"
+       ;;
+    *)
+       NET=
+       ;;
+esac
+
+[ -e disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
 
 ARGS=(
     -m 2G -M pc,accel=kvm -cpu host -vga qxl
@@ -28,6 +38,7 @@ ARGS=(
     $BOOT
     -drive index=0,id=disk,media=disk,format=raw,file=disk.raw
     $DISK2
+    $NET
 )
 
 exec qemu-system-x86_64 ${ARGS[@]}