[PR] dylanaraps/neofetch#1961 from satmandu - Add CPU temp file for Raspberry Pi/linux and fix CPU detection for Raspberry Pi devices

Upstream PR: https://github.com/dylanaraps/neofetch/pull/1961
Thanks to @satmandu

Co-authored-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-07-31 20:29:09 -04:00
commit aac56be0c1

View file

@ -2392,7 +2392,7 @@ get_cpu() {
;;
*)
cpu="$(awk -F '\\s*: | @' \
[[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \
'/model name|Hardware|Processor|^cpu model|chip type|^cpu type/ {
cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")"
;;
@ -2408,6 +2408,11 @@ get_cpu() {
break
}
done
# If on a Raspberry Pi...
if grep -q "Raspberry Pi" /proc/device-tree/model; then
temp_dir=/sys/class/thermal/thermal_zone0/temp
fi
# Get CPU speed.
if [[ -d "$speed_dir" ]]; then