Przeglądaj źródła

fix some problem in detecting cpu such as loongson

saeziae 2 lat temu
rodzic
commit
bce73f6836
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      neofetch

+ 2 - 3
neofetch

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