mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2024-11-26 13:09:41 +01:00
basic.sh: Add support for HEADLESS mode via environment
Currently if a user wants to run in headless mode they have to edit the basic.sh script by hand. Rather than making them edit the script by hand, add support for a HEADLESS environment variable which can be set to 1 to add necessary command line arguments to qemu.
This commit is contained in:
parent
b7f78be0c3
commit
98f1453fd1
2 changed files with 15 additions and 3 deletions
|
@ -27,8 +27,6 @@ Create an empty hard disk using `qemu-img`, changing the name and size to prefer
|
||||||
qemu-img create -f qcow2 MyDisk.qcow2 64G
|
qemu-img create -f qcow2 MyDisk.qcow2 64G
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: If you're running on a headless system (such as on Cloud providers), you will need to add `-nographic` and `-vnc :0 -k en-us` (for VNC support) to the end of `basic.sh`.
|
|
||||||
|
|
||||||
Then run `basic.sh` to start the machine and install macOS, setting the
|
Then run `basic.sh` to start the machine and install macOS, setting the
|
||||||
`SYSTEM_DISK` environment variable to the path to your freshly created
|
`SYSTEM_DISK` environment variable to the path to your freshly created
|
||||||
system disk image:
|
system disk image:
|
||||||
|
@ -37,6 +35,13 @@ system disk image:
|
||||||
SYSTEM_DISK=MyDisk.qcow2 ./basic.sh
|
SYSTEM_DISK=MyDisk.qcow2 ./basic.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you're running on a headless system (such as on Cloud providers), set
|
||||||
|
the `HEADLESS` environment variable to 1:
|
||||||
|
|
||||||
|
```
|
||||||
|
SYSTEM_DISK=MyDisk.qcow2 HEADLESS=1 ./basic.sh
|
||||||
|
```
|
||||||
|
|
||||||
Remember to partition in Disk Utility first!
|
Remember to partition in Disk Utility first!
|
||||||
|
|
||||||
## Step 2a (Virtual Machine Manager)
|
## Step 2a (Virtual Machine Manager)
|
||||||
|
|
9
basic.sh
9
basic.sh
|
@ -16,6 +16,12 @@ OVMF=$VMDIR/firmware
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MOREARGS=()
|
||||||
|
|
||||||
|
[[ "$HEADLESS" = "1" ]] && {
|
||||||
|
MOREARGS+=(-nographic -vnc :0 -k en-us)
|
||||||
|
}
|
||||||
|
|
||||||
qemu-system-x86_64 \
|
qemu-system-x86_64 \
|
||||||
-enable-kvm \
|
-enable-kvm \
|
||||||
-m 2G \
|
-m 2G \
|
||||||
|
@ -37,4 +43,5 @@ qemu-system-x86_64 \
|
||||||
-drive id=InstallMedia,if=none,file=BaseSystem.img \
|
-drive id=InstallMedia,if=none,file=BaseSystem.img \
|
||||||
-device ide-hd,bus=sata.3,drive=InstallMedia \
|
-device ide-hd,bus=sata.3,drive=InstallMedia \
|
||||||
-drive id=SystemDisk,if=none,file="${SYSTEM_DISK}" \
|
-drive id=SystemDisk,if=none,file="${SYSTEM_DISK}" \
|
||||||
-device ide-hd,bus=sata.4,drive=SystemDisk
|
-device ide-hd,bus=sata.4,drive=SystemDisk \
|
||||||
|
${MOREARGS[@]}
|
||||||
|
|
Loading…
Reference in a new issue