Compare commits

..

No commits in common. "78fdd1c4a0d2c6a7314f997340b588c9eccc2b48" and "3514fa96ef37f543adc17c3e2f704de51bbffe16" have entirely different histories.

View file

@ -1,30 +1,25 @@
#!/usr/bin/env sh
# What processor architecture to use
[ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m)
set -x
# What machine type to use
[ -z "$QEMUSH_MACHINE" ] && case "$QEMUSH_ARCH" in
x86_64)
QEMUSH_MACHINE=q35
;;
esac
# What processor architecture to use
arch=$QEMUSH_ARCH
[ -z "$arch" ] && arch=$(uname -m)
# How many CPU cores to use
[ -z "$QEMUSH_NPROC" ] && QEMUSH_NPROC=$(($(nproc) / 2))
nproc=$QEMUSH_NPROC
[ -z "$nproc" ] && nproc=$(($(nproc) / 2))
# How much RAM to use
[ -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" "$@"
ram=$QEMUSH_RAM
[ -z "$ram" ] && ram=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K
# Set the arguments
set -- "qemu-system-${QEMUSH_ARCH}" \
set -- "qemu-system-${arch}" \
-enable-kvm \
-cpu host -smp "$QEMUSH_NPROC" \
-m "$QEMUSH_RAM" \
-M q35 \
-cpu host -smp "$nproc" \
-m "$ram" \
"$@"
# Start the machine
set -x
exec "$@"