[F] Make android fall back to lscpu (Fix #120)

This commit is contained in:
Azalea
2026-06-03 04:53:47 +00:00
parent 8298079baa
commit 94db3d56fb
+10 -6
View File
@@ -3136,9 +3136,11 @@ get_cpu() {
"arm"* | "aarch64")
if [[ $(trim "$distro") == Android* ]]; then
# Android roms have modified cpuinfo that shows CPU model as a string
# Older Android ROMs show the CPU model as a string in cpuinfo.
cpu="$(awk -F':' '/Hardware/ {print $2; exit}' "$cpu_file")"
else
fi
if [[ -z "$cpu" ]] && command -v lscpu &> /dev/null; then
# ARM linux displays binary model code in cpuinfo, which needs to be decoded with lscpu
if ! command -v python3 &> /dev/null; then
cpu="$(lscpu | awk -F': ' '/Vendor ID/ {print $2; exit}' ) $(lscpu | awk -F': ' '/Model name/ {print $2; exit}')"
@@ -3186,11 +3188,13 @@ if __name__ == '__main__':
print('\n'.join(cpus))
END
tmp_cpus=$(python3 -c "$py_script")
while IFS= read -r line; do
prin "${subtitle:+${subtitle}}" "$line"
done <<< "$tmp_cpus"
if [[ "$tmp_cpus" ]]; then
while IFS= read -r line; do
prin "${subtitle:+${subtitle}}" "$line"
done <<< "$tmp_cpus"
return
return
fi
fi
fi
;;