Fixing GPU detection
This commit is contained in:
parent
0d2b750e37
commit
a9c573e59e
1 changed files with 6 additions and 1 deletions
|
|
@ -230,6 +230,11 @@ in
|
|||
local has_intel=false
|
||||
local has_amd=false
|
||||
local has_vm=false
|
||||
# Prefer hypervisor detection first to avoid misclassifying VMs as AMD
|
||||
if ${pkgs.systemd}/bin/systemd-detect-virt -q; then
|
||||
echo "vm"
|
||||
return
|
||||
fi
|
||||
|
||||
if ${pkgs.pciutils}/bin/lspci &> /dev/null; then # Check if lspci is available
|
||||
if ${pkgs.pciutils}/bin/lspci | ${pkgs.gnugrep}/bin/grep -qi 'vga\|3d\|display'; then
|
||||
|
|
@ -240,7 +245,7 @@ in
|
|||
has_amd=true
|
||||
elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'intel'; then
|
||||
has_intel=true
|
||||
elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'virtio\|vmware'; then
|
||||
elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'virtio\|vmware\|qxl\|qemu\|virtualbox\|bochs\|hyper-v\|microsoft'; then
|
||||
has_vm=true
|
||||
fi
|
||||
done < <(${pkgs.pciutils}/bin/lspci | ${pkgs.gnugrep}/bin/grep -i 'vga\|3d\|display')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue