qemush/qemu/launchers/kvm

21 lines
489 B
Text
Raw Normal View History

2024-03-09 23:28:50 +01:00
#!/usr/bin/env sh
# What processor architecture to use
[ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m)
2024-03-09 23:28:50 +01:00
# How many CPU cores to use
[ -z "$QEMUSH_NPROC" ] && QEMUSH_NPROC=$(($(nproc) / 2))
2023-12-13 12:41:28 +01:00
2024-03-09 23:28:50 +01:00
# How much RAM to use
[ -z "$QEMUSH_RAM" ] && QEMUSH_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-${QEMUSH_ARCH}" \
2024-03-09 23:28:50 +01:00
-enable-kvm \
-cpu host -smp "$QEMUSH_NPROC" \
-m "$QEMUSH_RAM" \
2024-03-09 23:28:50 +01:00
"$@"
2023-12-13 12:41:28 +01:00
2024-03-09 23:28:50 +01:00
# Start the machine
2024-03-12 10:47:46 +01:00
set -x
2024-03-09 23:28:50 +01:00
exec "$@"