fix(darwin): convert CPU flags from Linux format to Darwin format

This commit is contained in:
Martin Wimpress 2024-05-15 02:25:51 +01:00 committed by Martin Wimpress
parent c3792c61f4
commit a4818025d8
1 changed files with 3 additions and 1 deletions

View File

@ -246,7 +246,9 @@ function get_cpu_info() {
function check_cpu_flag() {
local HOST_CPU_FLAG=""
if [ "${OS_KERNEL}" == "Darwin" ]; then
HOST_CPU_FLAG="${1}^^"
# Convert the flag to uppercase and replace _ with .
HOST_CPU_FLAG="${1^^}"
HOST_CPU_FLAG="${HOST_CPU_FLAG//_/.}"
if sysctl -n machdep.cpu.features | grep -o "${HOST_CPU_FLAG}" > /dev/null; then
return 0
else