From c65f06d5b8e461a06c882d0cc102cccecd5bb40f Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Sun, 28 Feb 2021 09:10:42 -0700 Subject: [PATCH] Removed CPU detection in favor of architecture detection Provides a cleaner and more reliable way to determine what machine architecture is being used. --- lib/utilities.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/utilities.sh b/lib/utilities.sh index 31d76b4..48a50a5 100644 --- a/lib/utilities.sh +++ b/lib/utilities.sh @@ -28,13 +28,6 @@ get_basename() { } export -f get_basename -# Answers current CPU. -# Parameters: None. -get_cpu() { - printf "%s" "$(system_profiler SPHardwareDataType | awk '/Chip/ {print $3}')" -} -export -f get_cpu - # Answers the file extension. # Parameters: $1 (required) - The file name. get_extension() { @@ -52,7 +45,7 @@ export -f get_extension # Answers Homebrew root path. # Parameters: None. get_homebrew_root() { - if [[ -n "$(get_cpu)" ]]; then + if [[ "$(/usr/bin/arch)" == "arm64" ]]; then printf "%s" "/opt/homebrew" else printf "%s" "/usr/local/Homebrew" @@ -63,7 +56,7 @@ export -f get_homebrew_root # Answers Homebrew binary root path. # Parameters: None. get_homebrew_bin_root() { - if [[ -n "$(get_cpu)" ]]; then + if [[ "$(/usr/bin/arch)" == "arm64" ]]; then printf "%s" "/opt/homebrew/bin" else printf "%s" "/usr/local/bin"