2024-03-09 23:28:50 +01:00
|
|
|
#!/usr/bin/env sh
|
2024-03-11 15:11:17 +01:00
|
|
|
# What processor architecture to use
|
2024-03-12 10:48:32 +01:00
|
|
|
[ -z "$QEMUSH_ARCH" ] && QEMUSH_ARCH=$(uname -m)
|
2024-03-11 15:11:17 +01:00
|
|
|
|
2024-03-09 23:28:50 +01:00
|
|
|
# How many CPU cores to use
|
2024-03-12 10:48:32 +01:00
|
|
|
[ -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
|
2024-03-12 10:48:32 +01:00
|
|
|
[ -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
|
2024-03-12 10:48:32 +01:00
|
|
|
set -- "qemu-system-${QEMUSH_ARCH}" \
|
2024-03-09 23:28:50 +01:00
|
|
|
-enable-kvm \
|
2024-03-12 10:48:32 +01:00
|
|
|
-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 "$@"
|