qemush/qemu/launchers/kvm

22 lines
400 B
Text
Raw Normal View History

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