Skip to content

Commit 76f0172

Browse files
Use Please v17.24.2's pleasew script (#279)
Primarily, this is to make sure the correct Please binary is downloaded on linux_arm64.
1 parent 2bf7deb commit 76f0172

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

pleasew

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,44 @@ else
1717
RESET=''
1818
fi
1919

20+
OS=""
21+
ARCH=""
22+
23+
case "$(uname)" in
24+
Linux)
25+
OS=linux
26+
case "$(uname -m)" in
27+
x86_64) ARCH=amd64 ;;
28+
aarch64*|armv8b|armv8l) ARCH=arm64 ;;
29+
esac
30+
;;
31+
Darwin)
32+
OS=darwin
33+
case "$(uname -m)" in
34+
x86_64) ARCH=amd64 ;;
35+
arm64) ARCH=arm64 ;;
36+
esac
37+
;;
38+
FreeBSD)
39+
OS=freebsd
40+
case "$(uname -m)" in
41+
amd64) ARCH=amd64 ;;
42+
esac
43+
;;
44+
*)
45+
printf >&2 '%bPlease does not support the %s operating system.%b\n' \
46+
"${RED}" "$(uname)" "${RESET}"
47+
exit 1
48+
;;
49+
esac
2050

21-
DEFAULT_URL_BASE='https://get.please.build'
22-
23-
OS="$(uname)"
24-
25-
if [ "${OS}" = 'Darwin' ]; then
26-
# switch between mac amd64/arm64
27-
ARCH="$(uname -m)"
28-
else
29-
# default to amd64 on other operating systems
30-
# because we only build intel binaries
31-
ARCH='amd64'
51+
if [ -z "$ARCH" ]; then
52+
printf >&2 '%bPlease does not support the %s architecture on %s.%b\n' \
53+
"${RED}" "$(uname -m)" "$(uname)" "${RESET}"
54+
exit 1
3255
fi
3356

34-
case "${ARCH}" in
35-
aarch64_be|aarch64|armv8b|armv8l) ARCH='arm64' ;;
36-
x86_64) ARCH='amd64' ;;
37-
esac
57+
DEFAULT_URL_BASE='https://get.please.build'
3858

3959
has_command () {
4060
command -v "${1}" > /dev/null 2>&1
@@ -141,20 +161,7 @@ if [ "${VERSION:+x}" != 'x' ]; then
141161
VERSION=$(${TRANSFER_TOOL} ${TRANSFER_SILENT_OPTS} "${URL_BASE}"/latest_version)
142162
fi
143163

144-
# Find the os / arch to download. You can do this quite nicely with go env
145-
# but we use this script on machines that don't necessarily have Go itself.
146-
if [ "${OS}" = 'Linux' ]; then
147-
GOOS='linux'
148-
elif [ "${OS}" = 'Darwin' ]; then
149-
GOOS='darwin'
150-
elif [ "${OS}" = 'FreeBSD' ]; then
151-
GOOS='freebsd'
152-
else
153-
printf >&2 '%bUnknown operating system %s%b\n' "${RED}" "${OS}" "${RESET}"
154-
exit 1
155-
fi
156-
157-
PLEASE_URL="${URL_BASE}/${GOOS}_${ARCH}/${VERSION}/please_${VERSION}.tar.xz"
164+
PLEASE_URL="${URL_BASE}/${OS}_${ARCH}/${VERSION}/please_${VERSION}.tar.xz"
158165
DIR="${LOCATION}/${VERSION}"
159166

160167
# Potentially we could reuse this but it's easier not to really.
@@ -165,6 +172,10 @@ fi
165172
printf >&2 '%bDownloading Please %s to %s...%b\n' "${GREEN}" "${VERSION}" "${DIR}" "${RESET}"
166173
mkdir -p "${DIR}"
167174
${TRANSFER_TOOL} ${TRANSFER_PROGRESS_OPTS} "${PLEASE_URL}" | tar -xJpf- --strip-components=1 -C "${DIR}"
175+
if [ $? -ne 0 ]; then
176+
printf >&2 '%bFailed to download Please%b\n' "${RED}" "${RESET}"
177+
exit 1
178+
fi
168179

169180
# Link it all back up a dir
170181
for x in "${DIR}"/*; do

0 commit comments

Comments
 (0)