mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2024-11-26 21:19:41 +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)"
|
||||
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() {
|
||||
echo
|
||||
echo "Usage: $0"
|
||||
|
@ -21,7 +29,7 @@ error() {
|
|||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<suspend-to-disk enabled='no'/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<emulator>EMULATOR</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='VMDIR/ESP.qcow2'/>
|
||||
|
|
Loading…
Reference in a new issue