CPU [Linux]: Added CPU name detection for more architectures (#529)

This fixes #526.
This commit is contained in:
Herdiansyah 2016-12-15 18:03:10 +07:00 committed by GitHub
parent f64ecff479
commit 0fdd3b8637
2 changed files with 22 additions and 1 deletions

View File

@ -34,6 +34,10 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
- [Fish] Fixed memory leak caused by Fish.
**CPU**<br \>
- [Linux] Fixed issues with CPU name detection for architectures other than x86/amd64/ARM.
**Desktop Environment**<br \>
- Fixed issues where MATE wouldn't be detected properly.

View File

@ -734,7 +734,23 @@ get_cpu() {
# Get CPU name
case "$distro" in
"Android"*) cpu="$(getprop ro.product.board)" ;;
*) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;;
*)
case "$machine_arch" in
"frv" | "hppa" | "m68k" | "openrisc" | "or"* | "powerpc" | "ppc"* | "sparc"*)
cpu="$(awk -F':' '/^cpu\t|^CPU/ {printf $2; exit}' /proc/cpuinfo)"
;;
"s390"*)
cpu="$(awk -F'=' '/machine/ {print $4; exit}' /proc/cpuinfo)"
;;
"ia64" | "m32r")
cpu="$(awk -F':' '/model/ {print $2; exit}' /proc/cpuinfo)"
[[ -z "$cpu" ]] && cpu="$(awk -F':' '/family/ {printf $2; exit}' /proc/cpuinfo)"
;;
*)
cpu="$(awk -F ': | @' '/model name|Processor|^cpu model|chip type|^cpu type/ {printf $2; exit}' /proc/cpuinfo)"
;;
esac
;;
esac
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
@ -888,6 +904,7 @@ get_cpu() {
cpu="${cpu//Eight-Core}"
cpu="${cpu//Core}"
cpu="${cpu//with Radeon * Graphics}"
cpu="${cpu//, altivec supported}"
# Add cpu cores to output
[[ "$cpu_cores" != "off" && "$cores" ]] && \