Compare commits
No commits in common. "78fdd1c4a0d2c6a7314f997340b588c9eccc2b48" and "3514fa96ef37f543adc17c3e2f704de51bbffe16" have entirely different histories.
78fdd1c4a0
...
3514fa96ef
1 changed files with 12 additions and 17 deletions
|
@ -1,30 +1,25 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# What processor architecture to use
|
set -x
|
||||||
[ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m)
|
|
||||||
|
|
||||||
# What machine type to use
|
# What processor architecture to use
|
||||||
[ -z "$QEMUSH_MACHINE" ] && case "$QEMUSH_ARCH" in
|
arch=$QEMUSH_ARCH
|
||||||
x86_64)
|
[ -z "$arch" ] && arch=$(uname -m)
|
||||||
QEMUSH_MACHINE=q35
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# How many CPU cores to use
|
# 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
|
# How much RAM to use
|
||||||
[ -z "$QEMUSH_RAM" ] && QEMUSH_RAM=$(($(free | grep '^Mem:\s' | awk '{ print $NF }') / 2))K
|
ram=$QEMUSH_RAM
|
||||||
|
[ -z "$ram" ] && 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-${arch}" \
|
||||||
-enable-kvm \
|
-enable-kvm \
|
||||||
-cpu host -smp "$QEMUSH_NPROC" \
|
-M q35 \
|
||||||
-m "$QEMUSH_RAM" \
|
-cpu host -smp "$nproc" \
|
||||||
|
-m "$ram" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Start the machine
|
# Start the machine
|
||||||
set -x
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
Loading…
Reference in a new issue