[TOOLS] Dynamically replace machine type with highest supported QEMU version.

This commit is contained in:
ged 2019-06-21 14:29:30 -04:00 committed by Foxlet
parent 20d8871c09
commit 1429996890
2 changed files with 3 additions and 2 deletions

View file

@ -4,6 +4,7 @@
# by Foxlet <foxlet@furcode.co> # by Foxlet <foxlet@furcode.co>
VMDIR=$PWD VMDIR=$PWD
MACHINE=$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | egrep -oe ".*-[0-9.]+" | sort -rV | head -1)
OUT="template.xml" OUT="template.xml"
print_usage() { print_usage() {
@ -20,7 +21,7 @@ error() {
} }
generate(){ generate(){
sed -e "s|VMDIR|$VMDIR|g" tools/template.xml.in > $OUT sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
echo "$OUT has been generated in $VMDIR" echo "$OUT has been generated in $VMDIR"
} }

View file

@ -5,7 +5,7 @@
<currentMemory unit='KiB'>2097152</currentMemory> <currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>4</vcpu> <vcpu placement='static'>4</vcpu>
<os> <os>
<type arch='x86_64' machine='pc-q35-3.0'>hvm</type> <type arch='x86_64' machine='MACHINE'>hvm</type>
<loader readonly='yes' type='pflash'>VMDIR/firmware/OVMF_CODE.fd</loader> <loader readonly='yes' type='pflash'>VMDIR/firmware/OVMF_CODE.fd</loader>
<nvram>VMDIR/firmware/OVMF_VARS-1024x768.fd</nvram> <nvram>VMDIR/firmware/OVMF_VARS-1024x768.fd</nvram>
<boot dev='hd'/> <boot dev='hd'/>