forked from crossplane/crossplane
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·105 lines (92 loc) · 2 KB
/
install.sh
File metadata and controls
executable file
·105 lines (92 loc) · 2 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
set -eu
XP_CHANNEL=${XP_CHANNEL:-stable}
XP_VERSION=${XP_VERSION:-current}
os=$(uname -s)
arch=$(uname -m)
OS=${OS:-"${os}"}
ARCH=${ARCH:-"${arch}"}
OS_ARCH=""
COMPRESSED=${COMPRESSED:-"False"}
BIN=${BIN:-crank}
unsupported_arch() {
os="$1"
arch="$2"
echo "Crossplane does not support $os / $arch at this time."
exit 1
}
case $OS in
CYGWIN* | MINGW64* | Windows*)
if [ "$ARCH" = "x86_64" ]; then
OS_ARCH=windows_amd64
BIN=crank.exe
else
unsupported_arch "$OS" "$ARCH"
fi
;;
Darwin)
case $ARCH in
x86_64 | amd64)
OS_ARCH=darwin_amd64
;;
arm64)
OS_ARCH=darwin_arm64
;;
*)
unsupported_arch "$OS" "$ARCH"
;;
esac
;;
Linux)
case $ARCH in
x86_64 | amd64)
OS_ARCH=linux_amd64
;;
arm64 | aarch64)
OS_ARCH=linux_arm64
;;
*)
unsupported_arch "$OS" "$ARCH"
;;
esac
;;
*)
unsupported_arch "$OS" "$ARCH"
;;
esac
_compr=$(echo "$COMPRESSED" | tr '[:upper:]' '[:lower:]')
if [ "${_compr}" = "true" ]; then
url_dir="bundle"
url_file="crank.tar.gz"
url_error="a compressed file for "
else
url_dir="bin"
url_file="${BIN}"
url_error=""
fi
url="https://releases.crossplane.io/${XP_CHANNEL}/${XP_VERSION}/${url_dir}/${OS_ARCH}/${url_file}"
if ! curl -sfL "${url}" -o "${url_file}"; then
echo "Failed to download Crossplane CLI. Please make sure ${url_error}version ${XP_VERSION} exists on channel ${XP_CHANNEL}."
exit 1
fi
if [ "${_compr}" = "true" ]; then
if ! tar xzf "${url_file}"; then
echo "Failed to unpack the Crossplane CLI compressed file."
exit 1
fi
if ! mv "${BIN}" crossplane; then
echo "Failed to rename the unpacked Crossplane CLI binary: \"${BIN}\". Make sure it exists inside the compressed file."
exit 1
fi
rm "${BIN}.sha256" "${url_file}"
else
mv "${url_file}" crossplane
fi
chmod +x crossplane
echo "crossplane CLI downloaded successfully! Run the following commands to finish installing it:"
echo
echo sudo mv crossplane /usr/local/bin
echo crossplane --help
echo
echo "Visit https://crossplane.io to get started. 🚀"
printf "Have a nice day! 👋\n"