diff options
author | Ingar <ingar@osirion.org> | 2016-04-09 00:58:43 +0200 |
---|---|---|
committer | Ingar <ingar@osirion.org> | 2016-04-09 00:58:43 +0200 |
commit | 92289c867458f15132a5ed446cd300f94bce6bee (patch) | |
tree | 237e16948314d4758593a79bc2e164fe198eb8d2 | |
parent | be5e4f367adc03b95004cc7f1f6852599ece8d84 (diff) | |
parent | f6eb8916c118cc4bdf22cab4127864ecf8728d80 (diff) |
Merge pull request #5 from illwieckz/master
fix which lspci / call lspci once
-rwxr-xr-x | sysinfo.sh | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -47,11 +47,8 @@ disk_free=`echo $sua | awk '{printf "%d",$4/1048576;}'`; #---[ VGA ] --------------------------- gpu='' -if which lspci 2>/dev/null; then - gpu_slot=`lspci -mm | grep 'VGA' | head -n 1 | cut -f1 -d' '` - gpu_vendor=`lspci -s "${gpu_slot}" -mm -v | grep '^Vendor' | sed -e 's/Vendor:\t//' | sed -e 's/.*[ ]\[//;s/\].*//' | sed -e 's/, Inc.//;s/ Corporation//;s/ Co.//;s/,Ltd.//'` - gpu_model=`lspci -s "${gpu_slot}" -mm -v | grep '^Device' | sed -e 's/Device:\t//' | sed -e 's/.*[ ]\[//;s/\].*//'` - gpu="${gpu_vendor} ${gpu_model}" +if which lspci >/dev/null 2>/dev/null; then + gpu="`lspci -mm -v | grep -m 1 -A 2 VGA | tail -n +2 | sed -e 's/Vendor:\t//;s/Device:\t//' | sed -e 's/.*[ ]\[//;s/\].*//' | sed -e 's/, Inc.//;s/ Corporation//;s/ Co.//;s/,Ltd.//' | tr '\n' ' ' | sed -e 's/ $//'`" fi #---[ OUTPUT ]------------------------ |