-
Notifications
You must be signed in to change notification settings - Fork 201
/
install.sh
89 lines (76 loc) · 2.3 KB
/
install.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -e +o pipefail
show_help() {
cat << EOF
Alibaba Cloud Command Line Interface Installer
-h Display this help and exit
-V VERSION Custom CLI version. Default is 'latest'
EOF
}
abort() {
printf "%s\n" "$@" >&2
exit 1
}
# First check OS.
OS="$(uname)"
if [[ "${OS}" == "Linux" ]]
then
CLI_ON_LINUX=1
elif [[ "${OS}" == "Darwin" ]]
then
CLI_ON_MACOS=1
else
abort "Currently is only supported on macOS and Linux."
fi
VERSION="latest"
if [ $# != 0 ];
then
while getopts "hV:-" o
do
case "$o" in
"h")
show_help
exit 0;
;;
"V")
VERSION="$OPTARG"
;;
*)
echo -e "Unexpected flag not supported"
exit 1
;;
esac
done
fi
echo -e "
..............888888888888888888888 ........=8888888888888888888D=..............
...........88888888888888888888888 ..........D8888888888888888888888I...........
.........,8888888888888ZI: ...........................=Z88D8888888888D..........
.........+88888888 ..........................................88888888D..........
.........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D..........
.........+88888888 ............. ************* ..............O8888888D..........
.........+88888888 .... Command Line Interface(Reloaded) ....O8888888D..........
.........+88888888...........................................88888888D..........
..........D888888888888DO+. ..........................?ND888888888888D..........
...........O8888888888888888888888...........D8888888888888888888888=...........
............ .:D8888888888888888888.........78888888888888888888O ..............
"
if [[ -n "${CLI_ON_MACOS-}" ]]
then
curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-macosx-"$VERSION"-universal.tgz
tar zxf aliyun-cli-macosx-"$VERSION"-universal.tgz
mv ./aliyun /usr/local/bin/
fi
if [[ -n "${CLI_ON_LINUX-}" ]]
then
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "${UNAME_MACHINE}" == "arm64" || "${UNAME_MACHINE}" == "aarch64" ]]
then
curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-"$VERSION"-arm64.tgz
tar zxf aliyun-cli-linux-"$VERSION"-arm64.tgz
else
curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-"$VERSION"-amd64.tgz
tar zxf aliyun-cli-linux-"$VERSION"-amd64.tgz
fi
mv ./aliyun /usr/local/bin/
fi