-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
51 lines (40 loc) · 1.21 KB
/
install.sh
File metadata and controls
51 lines (40 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -u
abort() {
printf "%s\n" "$@" >&2
exit 1
}
OS="$(uname)"
UNAME_MACHINE="$(uname -m)"
if [[ "${OS}" == "Darwin" ]]
then
if [[ "${UNAME_MACHINE}" == "arm64" ]]
then
DOWNLOAD_URL="https://cli.metaplane.dev/spm/download/macos-arm64/metaplane"
else
echo "Unsupported architecture for macOS: ${UNAME_MACHINE}"
exit 1
fi
elif [[ "${UNAME_MACHINE}" == "x86_64" ]]
then
DOWNLOAD_URL="https://cli.metaplane.dev/spm/download/linux-x86_64/metaplane"
elif [[ "${UNAME_MACHINE}" == "aarch64" ]] || [[ "${UNAME_MACHINE}" == "arm64" ]]
then
DOWNLOAD_URL="https://cli.metaplane.dev/spm/download/linux-aarch64/metaplane"
else
echo "Unsupported architecture: ${UNAME_MACHINE}"
exit 1
fi
LOCAL_BIN=$HOME/.local/bin
mkdir -p $LOCAL_BIN
echo "Downloading the Metaplane CLI binary for ${OS} ${UNAME_MACHINE} to ${LOCAL_BIN}..."
curl -LSs $DOWNLOAD_URL -o $LOCAL_BIN/metaplane
if [ $? -ne 0 ]; then
abort "Failed to download the Metaplane CLI binary"
fi
chmod +x $LOCAL_BIN/metaplane
if ! command -v metaplane >/dev/null 2>&1; then
echo "Adding ${LOCAL_BIN} to the PATH"
export PATH=$LOCAL_BIN:$PATH
fi
echo "The Metaplane CLI has been stored in ${LOCAL_BIN}/metaplane and added to the PATH"