launchers/kvm : type de machine optionel

This commit is contained in:
Ahurac 2024-03-12 10:49:09 +01:00
parent 428ceb7738
commit 78fdd1c4a0

View file

@ -2,12 +2,22 @@
# What processor architecture to use # What processor architecture to use
[ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m) [ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m)
# What machine type to use
[ -z "$QEMUSH_MACHINE" ] && case "$QEMUSH_ARCH" in
x86_64)
QEMUSH_MACHINE=q35
;;
esac
# How many CPU cores to use # How many CPU cores to use
[ -z "$QEMUSH_NPROC" ] && QEMUSH_NPROC=$(($(nproc) / 2)) [ -z "$QEMUSH_NPROC" ] && QEMUSH_NPROC=$(($(nproc) / 2))
# How much RAM to use # How much RAM to use
[ -z "$QEMUSH_RAM" ] && QEMUSH_RAM=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K [ -z "$QEMUSH_RAM" ] && QEMUSH_RAM=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K
# Use selected QEMUSH_MACHINE type if set
[ -n "$QEMUSH_MACHINE" ] && set -- -M "$QEMUSH_MACHINE" "$@"
# Set the arguments # Set the arguments
set -- "qemu-system-${QEMUSH_ARCH}" \ set -- "qemu-system-${QEMUSH_ARCH}" \
-enable-kvm \ -enable-kvm \