fix: KVM flag (#273)
This commit is contained in:
parent
50639d9dbf
commit
deeaa9b6c3
1 changed files with 14 additions and 7 deletions
21
src/cpu.sh
21
src/cpu.sh
|
@ -6,10 +6,11 @@ set -Eeuo pipefail
|
||||||
: ${CPU_MODEL:='host'}
|
: ${CPU_MODEL:='host'}
|
||||||
: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}
|
: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}
|
||||||
|
|
||||||
KVM_ERR=""
|
[ "$ARCH" != "amd64" ] && KVM="N"
|
||||||
KVM_OPTS=""
|
|
||||||
|
|
||||||
if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then
|
if [[ "$KVM" != [Nn]* ]]; then
|
||||||
|
|
||||||
|
KVM_ERR=""
|
||||||
|
|
||||||
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
|
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
|
||||||
if ! grep -q -e vmx -e svm /proc/cpuinfo; then
|
if ! grep -q -e vmx -e svm /proc/cpuinfo; then
|
||||||
|
@ -20,16 +21,22 @@ if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$KVM_ERR" ]; then
|
if [ -n "$KVM_ERR" ]; then
|
||||||
|
KVM="N"
|
||||||
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 continue without KVM by setting KVM=N (not recommended)."
|
||||||
[[ "$DEBUG" != [Yy1]* ]] && exit 88
|
[[ "$DEBUG" != [Yy1]* ]] && exit 88
|
||||||
[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max,$CPU_FEATURES"
|
|
||||||
else
|
|
||||||
KVM_OPTS=",accel=kvm -enable-kvm"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$KVM" != [Nn]* ]]; then
|
||||||
|
|
||||||
|
KVM_OPTS=",accel=kvm -enable-kvm"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
KVM_OPTS=""
|
||||||
|
|
||||||
if [[ "$CPU_MODEL" == "host"* ]]; then
|
if [[ "$CPU_MODEL" == "host"* ]]; then
|
||||||
if [[ "$ARCH" == "amd64" ]]; then
|
if [[ "$ARCH" == "amd64" ]]; then
|
||||||
CPU_MODEL="max,$CPU_FEATURES"
|
CPU_MODEL="max,$CPU_FEATURES"
|
||||||
|
|
Loading…
Reference in a new issue