diff --git a/README.md b/README.md index cda4073..6263ae9 100644 --- a/README.md +++ b/README.md @@ -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 ``` -> 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 `SYSTEM_DISK` environment variable to the path to your freshly created system disk image: @@ -37,6 +35,13 @@ system disk image: 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! ## Step 2a (Virtual Machine Manager) diff --git a/basic.sh b/basic.sh index 12343b7..0b8263a 100755 --- a/basic.sh +++ b/basic.sh @@ -16,6 +16,12 @@ OVMF=$VMDIR/firmware exit 1 } +MOREARGS=() + +[[ "$HEADLESS" = "1" ]] && { + MOREARGS+=(-nographic -vnc :0 -k en-us) +} + qemu-system-x86_64 \ -enable-kvm \ -m 2G \ @@ -37,4 +43,5 @@ qemu-system-x86_64 \ -drive id=InstallMedia,if=none,file=BaseSystem.img \ -device ide-hd,bus=sata.3,drive=InstallMedia \ -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[@]}