fix(darwin): workaround machdep.cpu.vendor being invalid on Apple silicon

This commit is contained in:
Martin Wimpress 2024-05-16 09:45:21 +01:00 committed by Martin Wimpress
parent b7ab6f6d36
commit 6985a5f135
1 changed files with 6 additions and 2 deletions

View File

@ -225,11 +225,15 @@ function get_cpu_info() {
if [ "${OS_KERNEL}" == "Darwin" ]; then
if [ "^Model name:" == "${INFO_NAME}" ]; then
sysctl -n machdep.cpu.brand_string | sed 's/ //g'
sysctl -n machdep.cpu.brand_string
elif [ "Socket" == "${INFO_NAME}" ]; then
sysctl -n hw.packages
elif [ "Vendor" == "${INFO_NAME}" ]; then
sysctl -n machdep.cpu.vendor | sed 's/ //g'
if [ "${ARCH_HOST}" == "arm64" ]; then
sysctl -n machdep.cpu.brand_string | cut -d' ' -f1
else
sysctl -n machdep.cpu.vendor | sed 's/ //g'
fi
else
echo "ERROR! Could not find macOS translation for ${INFO_NAME}"
exit 1