From d65b5a089ab422a93cfeb8ec0161066f712c6152 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 3 Jan 2024 13:33:38 +0100 Subject: [PATCH] fix: KVM check (#529) --- src/proc.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/proc.sh b/src/proc.sh index 51b4792..ccece8e 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -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