VMs/arch/lib.sh
2024-02-27 21:08:33 +01:00

24 lines
481 B
Bash

#!/bin/bash -e
RAM="$(free -g | awk '/^Mem:/{print $2 - 2}')"
if [ "$RAM" -le 2 ]; then RAM=2
elif [ "$RAM" -gt 32 ]; then RAM=32; fi
RAM="${RAM}G"
CMD=(
qemu-system-x86_64
-accel kvm
-M q35
# usb
-device qemu-xhci
-cpu host
-m "2G,maxmem=$RAM"
-vga virtio
#-drive if=virtio,file=hda.qcow2
# shared memory
-object memory-backend-ram,id=mem,size=2G,share=on
-numa node,memdev=mem
)