[PR] #34 from saeziae: fix some problem in detecting cpu such as loongson

This commit is contained in:
Hykilpikonna 2022-11-03 23:45:36 -04:00 committed by GitHub
commit f93315a7ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2579,9 +2579,8 @@ END
esac esac
# If cpu is not detected on a platform-specific bases, fallback to cpuinfo method # If cpu is not detected on a platform-specific bases, fallback to cpuinfo method
[[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \ [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' '/model name|Model|uarch|Hardware|Processor|^cpu model|chip type|^cpu type/ { print $2; exit}' "$cpu_file")"
'/model name|Model|uarch|Hardware|Processor|^cpu model|chip type|^cpu type/ { [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' '/Hardware/ {print $2; exit}' "$cpu_file")"
cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")"
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"