Browse Source

Check if the img file exists and what type of disk it is (#836)

Rafa 8 months ago
parent
commit
550a8c8fee
2 changed files with 14 additions and 1 deletions
  1. 2 0
      .gitignore
  2. 12 1
      util/GO9PIMG

+ 2 - 0
.gitignore

@@ -75,6 +75,8 @@ build_out
 cron/lock
 /util/bldy
 util/third_party/src
+util/harvey.qcow2
+util/harvey.raw
 /home
 
 **/*.h.gch

+ 12 - 1
util/GO9PIMG

@@ -1,6 +1,17 @@
 #!/bin/bash
 set -e
 
+if [ -f "$HARVEY/util/harvey.qcow2" ]
+then
+	HARVEY_DISK="$HARVEY/util/harvey.qcow2"
+elif [ -f "$HARVEY/util/harvey.raw" ]
+then
+	HARVEY_DISK="$HARVEY/util/harvey.raw,format=raw"
+else
+	echo "ERROR: Disk image not found"
+	exit 1
+fi
+
 trap : 2
 
 $HARVEY/util/ufs -root=$HARVEY &
@@ -37,7 +48,7 @@ hostfwd=tcp::1666-:1666,\
 hostfwd=tcp::5356-:5356,\
 hostfwd=tcp::17013-:17013 \
 -object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
--drive id=disk,file=$HARVEY/util/harvey.qcow2,if=none \
+-drive id=disk,file=$HARVEY_DISK,if=none \
 -device ich9-ahci,id=ahci \
 -device ide-drive,drive=disk,bus=ahci.0 \
 $*