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