qemush/qemu/launchers/kvm

21 lines
400 B
Bash
Executable file

#!/usr/bin/env sh
set -x
# How many CPU cores to use
nproc=$QEMUSH_NPROC
[ -z "$nproc" ] && nproc=$(($(nproc) / 2))
# How much RAM to use
ram=$QEMUSH_RAM
[ -z "$ram" ] && ram=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K
# Set the arguments
set -- qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-cpu host -smp "$nproc" \
-m "$ram" \
"$@"
# Start the machine
exec "$@"