Remove duplicate blocks in getcpu
This commit is contained in:
parent
e3a27d6093
commit
7770c9a3cd
1 changed files with 2 additions and 21 deletions
23
fetch
23
fetch
|
@ -774,7 +774,7 @@ getcpu () {
|
|||
cpu="$(sysctl -n machdep.cpu.brand_string)"
|
||||
;;
|
||||
|
||||
*"BSD")
|
||||
*"BSD" | "Windows")
|
||||
case "$distro" in
|
||||
"OpenBSD"* | "FreeBSD"*)
|
||||
# Get cpu name
|
||||
|
@ -791,7 +791,7 @@ getcpu () {
|
|||
speed=$((speed / 100))
|
||||
;;
|
||||
|
||||
"NetBSD"*)
|
||||
"NetBSD"* | "Windows"*)
|
||||
# Get cpu name
|
||||
cpu="$(grep -F 'model name' /proc/cpuinfo)"
|
||||
cpu=${cpu/model name*: }
|
||||
|
@ -811,25 +811,6 @@ getcpu () {
|
|||
cpu="$cpu @ ${speed}GHz"
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
# Get cpu name
|
||||
cpu="$(grep -F 'model name' /proc/cpuinfo)"
|
||||
cpu=${cpu/model name*: }
|
||||
cpu=${cpu/ @*}
|
||||
cpu=${cpu// }
|
||||
cpu=${cpu% }
|
||||
|
||||
# Get cpu speed
|
||||
speed=$(grep -F 'cpu MHz' /proc/cpuinfo)
|
||||
speed=${speed/cpu MHz*: }
|
||||
speed=${speed/\.}
|
||||
|
||||
# Convert mhz to ghz without bc
|
||||
speed=$((speed / 100000))
|
||||
speed=${speed:0:1}.${speed:1}
|
||||
cpu="$cpu @ ${speed}GHz"
|
||||
;;
|
||||
|
||||
*)
|
||||
cpu="Unknown"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue