mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2024-11-30 06:59:42 +01:00
make.sh: use NixOS' emulator if it exists
This commit is contained in:
parent
9c270f2c72
commit
73bc2b0e4c
2 changed files with 10 additions and 2 deletions
10
make.sh
10
make.sh
|
@ -7,6 +7,14 @@ VMDIR=$PWD
|
||||||
MACHINE="$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | grep -Eoe ".*-[0-9.]+" | sort -rV | head -1)"
|
MACHINE="$(qemu-system-x86_64 --machine help | grep q35 | cut -d" " -f1 | grep -Eoe ".*-[0-9.]+" | sort -rV | head -1)"
|
||||||
OUT="template.xml"
|
OUT="template.xml"
|
||||||
|
|
||||||
|
NIX_EMULATOR="/run/libvirt/nix-emulators/qemu-system-x86_64"
|
||||||
|
|
||||||
|
if [ -e $NIX_EMULATOR ]; then
|
||||||
|
EMULATOR=$NIX_EMULATOR
|
||||||
|
else
|
||||||
|
EMULATOR="/usr/bin/qemu-system-x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0"
|
echo "Usage: $0"
|
||||||
|
@ -21,7 +29,7 @@ error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generate(){
|
generate(){
|
||||||
sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
|
sed -e "s|VMDIR|$VMDIR|g" -e "s|MACHINE|$MACHINE|g" -e "s|EMULATOR|$EMULATOR|g" tools/template.xml.in > $OUT
|
||||||
echo "$OUT has been generated in $VMDIR"
|
echo "$OUT has been generated in $VMDIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<suspend-to-disk enabled='no'/>
|
<suspend-to-disk enabled='no'/>
|
||||||
</pm>
|
</pm>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
<emulator>EMULATOR</emulator>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
<driver name='qemu' type='qcow2'/>
|
<driver name='qemu' type='qcow2'/>
|
||||||
<source file='VMDIR/ESP.qcow2'/>
|
<source file='VMDIR/ESP.qcow2'/>
|
||||||
|
|
Loading…
Reference in a new issue