Skip to content

Commit

Permalink
fix: KVM check (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 3, 2024
1 parent 8464364 commit d65b5a0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/proc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ if [[ "$KVM" != [Nn]* ]]; then

KVM_ERR=""

if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
if ! grep -q -e vmx -e svm /proc/cpuinfo; then
KVM_ERR="(vmx/svm disabled)"
fi
if [ ! -e /dev/kvm ]; then
KVM_ERR="(device file missing)"
else
[ -e /dev/kvm ] && KVM_ERR="(no write access)" || KVM_ERR="(device file missing)"
if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then
KVM_ERR="(no write access)"
else
if ! grep -q -e vmx -e svm /proc/cpuinfo; then
KVM_ERR="(vmx/svm disabled)"
fi
fi
fi

if [ -n "$KVM_ERR" ]; then
Expand Down

0 comments on commit d65b5a0

Please sign in to comment.