Hopefully fixed blank gpu with nvidia cards

This commit is contained in:
Dylan 2016-01-21 07:20:42 +11:00
parent 19b4861e83
commit c5c34637b8
1 changed files with 29 additions and 33 deletions

62
fetch
View File

@ -661,46 +661,42 @@ getcpu () {
getgpu () { getgpu () {
case "$os" in case "$os" in
"Linux" | "OpenBSD") "Linux" | "OpenBSD")
if type -p nvidia-smi >/dev/null 2>&1; then gpu="$(lspci | grep "VGA")"
gpu="$(nvidia-smi | awk -F':' '/Product Name/ {printf $2}')" gpu=${gpu/* VGA compatible controller: }
else gpu=${gpu/(rev*)}
gpu="$(lspci | grep "VGA")"
gpu=${gpu/* VGA compatible controller: }
gpu=${gpu/(rev*)}
shopt -s nocasematch shopt -s nocasematch
case "$gpu" in case "$gpu" in
intel*) intel*)
gpu=${gpu/'Intel Corporation' } gpu=${gpu/'Intel Corporation' }
gpu=${gpu/'Haswell-'??? } gpu=${gpu/'Haswell-'??? }
brand="Intel" brand="Intel"
;; ;;
advanced*) advanced*)
gpu=${gpu/'Advanced Micro Devices, Inc.' } gpu=${gpu/'Advanced Micro Devices, Inc.' }
gpu=${gpu/'[AMD/ATI]' } gpu=${gpu/'[AMD/ATI]' }
gpu=${gpu/'Tahiti PRO'} gpu=${gpu/'Tahiti PRO'}
gpu=${gpu/'Mars'} gpu=${gpu/'Mars'}
gpu=${gpu/' ['} gpu=${gpu/' ['}
gpu=${gpu/']'} gpu=${gpu/']'}
brand="AMD" brand="AMD"
;; ;;
nvidia*) nvidia*)
gpu=${gpu/'NVIDIA Corporation' } gpu=${gpu/'NVIDIA Corporation' }
gpu=${gpu/'nVidia Corporation' } gpu=${gpu/'nVidia Corporation' }
gpu=${gpu/G???? } gpu=${gpu/G???? }
gpu=${gpu/'['} gpu=${gpu/'['}
gpu=${gpu/']'} gpu=${gpu/']'}
brand="Nvidia" brand="Nvidia"
;; ;;
esac esac
gpu="$brand $gpu" gpu="$brand $gpu"
fi
;; ;;
"Mac OS X") "Mac OS X")