tools/deploy-qemu: add macOS support

Just a few tweaks were necessary to add support for macOS:

1. /usr/bin/bash → /bin/bash, which is a link on Linux as well.

2. Use hdiutil instead of genisoimage to make the cloud-init iso.

3. Ask qemu to fall back to macOS' hypervisor hvf.
This commit is contained in:
Lars Karlitski 2020-11-23 19:31:09 +01:00 committed by Ondřej Budai
parent 4c9eea130d
commit 07b2486dcb

View file

@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/bin/bash
#
# deploy-qemu IMAGE USERDATA
@ -39,19 +39,28 @@ fi
echo -e "instance-id: nocloud\nlocal-hostname: vm\n" > "$workdir/cidata/meta-data"
genisoimage \
-input-charset utf-8 \
-output "$workdir/cloudinit.iso" \
-volid cidata \
-joliet \
-rock \
-quiet \
-graft-points \
"$workdir/cidata/user-data" \
"$workdir/cidata/meta-data"
case $(uname -s) in
"Linux")
genisoimage \
-input-charset utf-8 \
-output "$workdir/cloudinit.iso" \
-volid cidata \
-joliet \
-rock \
-quiet \
-graft-points \
"$workdir/cidata/user-data" \
"$workdir/cidata/meta-data"
;;
"Darwin")
# conviently uses the last component of source as volumeid, which has to be cidata
hdiutil makehybrid -iso -joliet -o "$workdir/cloudinit.iso" "$workdir/cidata"
;;
esac
qemu-system-x86_64 \
-enable-kvm \
-M accel=kvm:hvf \
-m 1024 \
-snapshot \
-cpu host \