-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinstall-v2.sh
66 lines (47 loc) · 1.67 KB
/
install-v2.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env sh
# Invoking this script:
#
# To install the latest stable version:
# curl https://raw.githubusercontent.com/teamhephy/workflow-cli/master/install-v2.sh | sh
#
# To install a specific released version ($VERSION):
# curl https://raw.githubusercontent.com/teamhephy/workflow-cli/master/install-v2.sh | sh -s $VERSION
#
# - download deis cli binary
# - making sure deis cli binary is executable
# - explain what was done
#
# install current version unless overridden by first command-line argument
VERSION=${1:-stable}
set -euf
check_platform_arch() {
local supported="linux-amd64 darwin-amd64"
if ! echo "${supported}" | tr ' ' '\n' | grep -q "${PLATFORM}-${ARCH}"; then
cat <<EOF
The Hephy Workflow CLI (deis) is not currently supported on ${PLATFORM}-${ARCH}.
See https://github.com/teamhephy/workflow-cli for more information.
EOF
fi
}
PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
# https://storage.googleapis.com/hephy-workflow-cli-release/v2.18.0/deis-v2.18.0-darwin-386
DEIS_BIN_URL_BASE="https://storage.googleapis.com/hephy-workflow-cli-release"
if [ "${ARCH}" = "x86_64" ]; then
ARCH="amd64"
fi
check_platform_arch
DEIS_CLI="deis-${VERSION}-${PLATFORM}-${ARCH}"
DEIS_CLI_PATH="${DEIS_CLI}"
if [ "${VERSION}" != 'stable' ]; then
DEIS_CLI_PATH="${VERSION}/${DEIS_CLI_PATH}"
fi
echo "Downloading ${DEIS_CLI} From Google Cloud Storage..."
echo "Downloading binary from here: ${DEIS_BIN_URL_BASE}/${DEIS_CLI_PATH}"
curl -fsSL -o deis "${DEIS_BIN_URL_BASE}/${DEIS_CLI_PATH}"
chmod +x deis
cat <<EOF
The Hephy Workflow CLI (deis) is now available in your current directory.
To learn more about Hephy Workflow, execute:
$ ./deis --help
EOF