mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2025-01-08 10:09:44 +01:00
Add install to Boxes folder
This commit is contained in:
parent
3d46a6c1a3
commit
78acf4dd89
2 changed files with 38 additions and 10 deletions
30
make.sh
30
make.sh
|
@ -4,14 +4,19 @@
|
||||||
# by Foxlet <foxlet@furcode.co>
|
# by Foxlet <foxlet@furcode.co>
|
||||||
|
|
||||||
VMDIR=$PWD
|
VMDIR=$PWD
|
||||||
|
QEMU_HOME="$HOME/.config/libvirt/qemu"
|
||||||
|
BOXES_HOME="$HOME/.local/share/gnome-boxes/images"
|
||||||
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"
|
||||||
|
SIZE=60G
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0"
|
echo "Usage: $0"
|
||||||
echo
|
echo
|
||||||
echo " -a, --add Add XML to virsh (uses sudo)."
|
echo " -a, --add Add XML to virsh (uses sudo)."
|
||||||
|
echo
|
||||||
|
echo " -i, --install Install virtual machine in GNOME Boxes."
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,16 +27,33 @@ error() {
|
||||||
|
|
||||||
generate(){
|
generate(){
|
||||||
UUID=$( cat /proc/sys/kernel/random/uuid )
|
UUID=$( cat /proc/sys/kernel/random/uuid )
|
||||||
sed -e "s|VMDIR|$VMDIR|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|g" tools/template.xml.in > $OUT
|
sed -e "s|BOXESHOME|$BOXES_HOME|g" -e "s|QEMUHOME|$QEMU_HOME|g" -e "s|UUID|$UUID|g" -e "s|MACHINE|$MACHINE|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"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install(){
|
||||||
|
echo Creating direcories $QEMU_HOME/firmware and $BOXES_HOME
|
||||||
|
mkdir -p $BOXES_HOME
|
||||||
|
mkdir -p $QEMU_HOME/firmware
|
||||||
|
echo Creating system disk $BOXES_HOME/macOS.qcow2 of size $SIZE
|
||||||
|
qemu-img create -f qcow2 $BOXES_HOME/macOS.qcow2 $SIZE
|
||||||
|
echo Coping BaseSystem.img and ESP.qcow2 in $BOXES_HOME
|
||||||
|
cp -Zfu BaseSystem.img $BOXES_HOME
|
||||||
|
cp -Zfu ESP.qcow2 $BOXES_HOME
|
||||||
|
echo Coping OVMF_CODE.fd in $QEMU_HOME/firmware/
|
||||||
|
cp firmware/OVMF_CODE.fd $QEMU_HOME/firmware/
|
||||||
|
echo Coping OVMF_CODE.fd in $QEMU_HOME/nvram/
|
||||||
|
cp firmware/OVMF_VARS-1024x768.fd $QEMU_HOME/nvram/
|
||||||
|
echo Adding template.xml to GNOME Boxes domain
|
||||||
|
virsh -c qemu:///session define $OUT
|
||||||
|
}
|
||||||
|
|
||||||
generate
|
generate
|
||||||
|
|
||||||
argument="$1"
|
argument="$1"
|
||||||
case $argument in
|
case $argument in
|
||||||
-a|--add)
|
-i|--install)
|
||||||
virsh -c qemu:///session define $OUT
|
install
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
print_usage
|
print_usage
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
<name>macOS-Simple-KVM</name>
|
<name>macOS-Simple-KVM</name>
|
||||||
<uuid>UUID</uuid>
|
<uuid>UUID</uuid>
|
||||||
<title>macOS</title>
|
<title>macOS</title>
|
||||||
<memory unit="KiB">2097152</memory>
|
<memory unit="KiB">4194304</memory>
|
||||||
<currentMemory unit="KiB">2097152</currentMemory>
|
<currentMemory unit="KiB">4194304</currentMemory>
|
||||||
<vcpu placement="static">4</vcpu>
|
<vcpu placement="static">4</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch="x86_64" machine="MACHINE">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">QEMUHOME/firmware/OVMF_CODE.fd</loader>
|
||||||
<nvram>VMDIR/firmware/OVMF_VARS-1024x768.fd</nvram>
|
<nvram>QEMUHOME/nvram/OVMF_VARS-1024x768.fd</nvram>
|
||||||
<boot dev="hd" />
|
<boot dev="hd" />
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
|
@ -35,16 +35,22 @@
|
||||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
<emulator>/usr/bin/qemu-system-x86_64</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="BOXESHOME/ESP.qcow2" />
|
||||||
<target dev="sda" bus="sata" />
|
<target dev="sda" bus="sata" />
|
||||||
<address type="drive" controller="0" bus="0" target="0" unit="0" />
|
<address type="drive" controller="0" bus="0" target="0" unit="0" />
|
||||||
</disk>
|
</disk>
|
||||||
<disk type="file" device="disk">
|
<disk type="file" device="disk">
|
||||||
<driver name="qemu" type="raw" />
|
<driver name="qemu" type="raw" />
|
||||||
<source file="VMDIR/BaseSystem.img" />
|
<source file="BOXESHOME/BaseSystem.img" />
|
||||||
<target dev="sdb" bus="sata" />
|
<target dev="sdb" bus="sata" />
|
||||||
<address type="drive" controller="0" bus="0" target="0" unit="1" />
|
<address type="drive" controller="0" bus="0" target="0" unit="1" />
|
||||||
</disk>
|
</disk>
|
||||||
|
<disk type="file" device="disk">
|
||||||
|
<driver name="qemu" type="raw" />
|
||||||
|
<source file="BOXESHOME/macOS.img" />
|
||||||
|
<target dev="sdb" bus="sata" />
|
||||||
|
<address type="drive" controller="0" bus="0" target="0" unit="2" />
|
||||||
|
</disk>
|
||||||
<controller type="usb" index="0" model="ich9-ehci1">
|
<controller type="usb" index="0" model="ich9-ehci1">
|
||||||
<address type="pci" domain="0x0000" bus="0x00" slot="0x1d" function="0x7" />
|
<address type="pci" domain="0x0000" bus="0x00" slot="0x1d" function="0x7" />
|
||||||
</controller>
|
</controller>
|
||||||
|
|
Loading…
Reference in a new issue