abbiefetch/processor_detection.4

48 lines
3 KiB
Groff
Raw Permalink Normal View History

2024-11-12 19:03:12 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "openbsd" ] && [ -z "$processor" ]; then
2024-11-12 17:53:59 +00:00
processor="$(sysctl hw.model | awk -F "=" '{print $2}')"
fi
2024-11-12 19:03:12 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "freebsd" ] && [ -z "$processor" ]; then
2024-11-12 17:53:59 +00:00
processor="$(sysctl hw.model | awk -F ": " '{print $2}')"
fi
2024-11-12 19:03:12 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "netbsd" ] && [ -z "$processor" ]; then
2024-11-12 17:53:59 +00:00
processor="$(sysctl machdep.cpu_brand | awk -F " = " '{print $2}')"
fi
2024-11-12 19:03:12 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "haiku" ] && [ -z "$processor" ]; then
2024-11-12 17:53:59 +00:00
processor="$(sysinfo | grep "CPU #0" | awk -F "\"" '{ print $2 }')"
fi
2024-11-12 19:03:12 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "linux" ] || [ "$system_type" = "windows" -a "$subtype" = "cygwin" ] && [ -z "$processor" ]; then
2024-11-12 17:53:59 +00:00
if [ -n "$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')"
2024-11-12 19:03:12 +00:00
elif [ -n "$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')" ] && [ "$subtype" = "chumby" -o "$subtype" = "rpi" ]; then
2024-11-12 17:53:59 +00:00
processor="$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')"
fi
fi
2024-11-12 19:12:32 +00:00
if [ "$hassed" -eq 1 ] && [ "$system_type" = "windows" ] && [ -z "$processor" ]; then
if [ -n "$(wmic.exe cpu get name | sed -n 2p | head -n 1)" ]; then
processor="$(wmic.exe cpu get name | sed -n 2p | head -n 1)"
fi
fi
if [ "$subtype" = "android" ]; then
if [ -n "$(getprop ro.soc.manufacturer)$(getprop ro.soc.model)" ]; then
processor="$(getprop ro.soc.manufacturer) $(getprop ro.soc.model)"
elif [ -n "$(getprop ro.hardware.chipname)" ]; then
processor="$(getprop ro.hardware.chipname)"
fi
fi
2024-11-13 20:16:59 +00:00
if [ "$hasawk" -eq 1 ] && [ "$system_type" = "illumos" ] && [ -z "$processor" ]; then
if [ -n "$(kstat | grep brand)" ]; then
2024-11-13 20:16:59 +00:00
processor="$(kstat | grep brand | head -n 1 | tr -s " " | awk -F "brand " '{print $2}')"
fi
fi
2024-11-12 17:53:59 +00:00
if [ "$hassed" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -n "$processor" ]; then
if [ -n "$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")" ]; then
processor="$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")"
fi
fi