fix: CPU features (#265)

This commit is contained in:
Kroese 2023-12-25 06:03:08 +01:00 committed by GitHub
parent 406d71343d
commit 07579f0c4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,9 @@
set -Eeuo pipefail set -Eeuo pipefail
# Docker environment variables # Docker environment variables
: ${CPU_MODEL:='host'} : ${CPU_MODEL:='host'}
: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}
KVM_ERR="" KVM_ERR=""
KVM_OPTS="" KVM_OPTS=""
@ -21,14 +23,20 @@ if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then
error "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance." error "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance."
error "See the FAQ on how to enable it, or skip this error by setting KVM=N (not recommended)." error "See the FAQ on how to enable it, or skip this error by setting KVM=N (not recommended)."
[[ "$DEBUG" != [Yy1]* ]] && exit 88 [[ "$DEBUG" != [Yy1]* ]] && exit 88
[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max" [[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max,$CPU_FEATURES"
else else
KVM_OPTS=",accel=kvm -enable-kvm" KVM_OPTS=",accel=kvm -enable-kvm"
fi fi
else else
[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max" if [[ "$CPU_MODEL" == "host"* ]]; then
if [[ "$ARCH" == "amd64" ]]; then
CPU_MODEL="max,$CPU_FEATURES"
else
CPU_MODEL="qemu64,$CPU_FEATURES"
fi
fi
fi fi