22 lines
563 B
Bash
Executable File
22 lines
563 B
Bash
Executable File
#!/bin/sh
|
|
set -euo pipefail
|
|
|
|
API_SOCKET="/hy.socks"
|
|
|
|
_stop() {
|
|
ch-remote --api-socket "$API_SOCKET" power-button
|
|
}
|
|
|
|
trap _stop EXIT TERM
|
|
|
|
/usr/bin/cloud-hypervisor \
|
|
--kernel /boot/vmlinuz-virt --initramfs /boot/initramfs-virt \
|
|
--disk path=/image/vm.raw,image_type=raw \
|
|
--disk path=/image/data.raw,direct=on,image_type=raw \
|
|
--api-socket "$API_SOCKET" \
|
|
--cmdline "root=/dev/vda rootfstype=ext4 modules=ext4a rw console=hvc0" \
|
|
--cpus boot=${CPU_COUNT:-4} \
|
|
--memory size=${MEMORY:-4G},shared=on \
|
|
--net "tap=$NET_INTERFACE,mac=$NET_MAC"
|
|
$@
|