If a GPU with a prefix of '3D' exists, use it instead.

This commit is contained in:
Dylan 2016-02-12 00:00:41 +11:00
parent 371bd64a8e
commit 2e0e3f5d64
1 changed files with 7 additions and 1 deletions

8
fetch
View File

@ -876,13 +876,18 @@ getcpu () {
getgpu () {
case "$os" in
"Linux")
# Get the GPUs
gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")"
# If a GPU with a prefix of '3D' doesn't exist
# fallback to looking for a prefix of 'VGA'
[ -z "$gpu" ] && \
gpu="$(PATH="/sbin:$PATH" lspci | grep -F "VGA")"
gpu=${gpu//??':'??'.'?}
# Count the number of GPUs
count="$(printf "%s" "$gpu" | uniq -c)"
count=${count/ VGA*}
count=${count/ 3D*}
count=${count//[[:space:]]}
# If there's more than one gpu
@ -895,6 +900,7 @@ getgpu () {
# Format the output
gpu=${gpu/* VGA compatible controller: }
gpu=${gpu/* 3D controller: }
gpu=${gpu/(rev*)}
shopt -s nocasematch