Skip to content

Commit 0cc56ec

Browse files
committed
scripts: template_setup_posix: Add Bash 3.x support on M1 Mac
The macOS default Bash 3.x (`/bin/bash`) sets the `HOSTTYPE` variable to `arm64` instead of `aarch64` on the M1 Macs, causing the setup script to try fetching the toolchain tarballs from an incorrect URL. This commit updates the setup script to re-set the `HOSTTYPE` variable to `aarch64` if `arm64` is set by the Bash. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 524d52f commit 0cc56ec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/template_setup_posix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,17 @@ version=$(<sdk_version)
185185

186186
# Resolve host type
187187
case ${OSTYPE} in
188-
linux-gnu*) host="linux-${HOSTTYPE}" ;;
189-
darwin*) host="macos-${HOSTTYPE}" ;;
188+
linux-gnu*)
189+
host="linux-${HOSTTYPE}"
190+
;;
191+
darwin*)
192+
# Bash 3.x on AArch64 Darwin sets HOSTTYPE to 'arm64'
193+
if [ "${HOSTTYPE}" = "arm64" ]; then
194+
HOSTTYPE="aarch64"
195+
fi
196+
197+
host="macos-${HOSTTYPE}"
198+
;;
190199
*)
191200
echo "ERROR: Unsupported host operating system"
192201
exit 5

0 commit comments

Comments
 (0)