mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2025-01-07 17:49: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>
|
||||
|
||||
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)"
|
||||
OUT="template.xml"
|
||||
SIZE=60G
|
||||
|
||||
print_usage() {
|
||||
echo
|
||||
echo "Usage: $0"
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -22,16 +27,33 @@ error() {
|
|||
|
||||
generate(){
|
||||
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"
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
argument="$1"
|
||||
case $argument in
|
||||
-a|--add)
|
||||
virsh -c qemu:///session define $OUT
|
||||
-i|--install)
|
||||
install
|
||||
;;
|
||||
-h|--help)
|
||||
print_usage
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<name>macOS-Simple-KVM</name>
|
||||
<uuid>UUID</uuid>
|
||||
<title>macOS</title>
|
||||
<memory unit="KiB">2097152</memory>
|
||||
<currentMemory unit="KiB">2097152</currentMemory>
|
||||
<memory unit="KiB">4194304</memory>
|
||||
<currentMemory unit="KiB">4194304</currentMemory>
|
||||
<vcpu placement="static">4</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="MACHINE">hvm</type>
|
||||
<loader readonly="yes" type="pflash">VMDIR/firmware/OVMF_CODE.fd</loader>
|
||||
<nvram>VMDIR/firmware/OVMF_VARS-1024x768.fd</nvram>
|
||||
<loader readonly="yes" type="pflash">QEMUHOME/firmware/OVMF_CODE.fd</loader>
|
||||
<nvram>QEMUHOME/nvram/OVMF_VARS-1024x768.fd</nvram>
|
||||
<boot dev="hd" />
|
||||
</os>
|
||||
<features>
|
||||
|
@ -35,16 +35,22 @@
|
|||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu" type="qcow2" />
|
||||
<source file="VMDIR/ESP.qcow2" />
|
||||
<source file="BOXESHOME/ESP.qcow2" />
|
||||
<target dev="sda" bus="sata" />
|
||||
<address type="drive" controller="0" bus="0" target="0" unit="0" />
|
||||
</disk>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu" type="raw" />
|
||||
<source file="VMDIR/BaseSystem.img" />
|
||||
<source file="BOXESHOME/BaseSystem.img" />
|
||||
<target dev="sdb" bus="sata" />
|
||||
<address type="drive" controller="0" bus="0" target="0" unit="1" />
|
||||
</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">
|
||||
<address type="pci" domain="0x0000" bus="0x00" slot="0x1d" function="0x7" />
|
||||
</controller>
|
||||
|
|
Loading…
Reference in a new issue