mirror of
https://github.com/hykilpikonna/hyfetch.git
synced 2026-08-27 19:25:13 -05:00
[F] Fix CPU identification on PRoot-Distro on Android (Closes #355)
This commit is contained in:
25
neofetch
25
neofetch
@@ -3193,9 +3193,30 @@ get_cpu() {
|
||||
;;
|
||||
|
||||
"arm"* | "aarch64")
|
||||
if [[ $(trim "$distro") == Android* ]]; then
|
||||
# Older Android ROMs show the CPU model as a string in cpuinfo.
|
||||
if [[ $(trim "$distro") == Android* ]] || [[ -d /system/app && -d /system/priv-app ]]; then
|
||||
# Android and Termux PRoot sessions can expose a useful SoC name here.
|
||||
cpu="$(awk -F':' '/Hardware/ {print $2; exit}' "$cpu_file")"
|
||||
|
||||
if [[ -z "$cpu" ]]; then
|
||||
getprop_cmd=
|
||||
|
||||
if command -v getprop &> /dev/null; then
|
||||
getprop_cmd="$(command -v getprop)"
|
||||
elif [[ -x /system/bin/getprop ]]; then
|
||||
getprop_cmd="/system/bin/getprop"
|
||||
fi
|
||||
|
||||
if [[ "$getprop_cmd" ]]; then
|
||||
cpu="$("$getprop_cmd" ro.soc.model 2>/dev/null)"
|
||||
[[ -z "$cpu" ]] && cpu="$("$getprop_cmd" ro.product.oplus.cpuinfo 2>/dev/null)"
|
||||
|
||||
case ${cpu,,} in
|
||||
"sm8350") cpu="Qualcomm Snapdragon 888" ;;
|
||||
"sm8350-ac") cpu="Qualcomm Snapdragon 888+" ;;
|
||||
sm*) cpu="Qualcomm ${cpu^^}" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$cpu" ]] && command -v lscpu &> /dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user