Unverified Commit d65b5a08 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: KVM check (#529)

parent 84643647
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -14,12 +14,16 @@ if [[ "$KVM" != [Nn]* ]]; then

  KVM_ERR=""

  if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
  if [ ! -e /dev/kvm ]; then
    KVM_ERR="(device file missing)"
  else
    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
  else
    [ -e /dev/kvm ] && KVM_ERR="(no write access)" || KVM_ERR="(device file missing)"
    fi
  fi

  if [ -n "$KVM_ERR" ]; then