forked from axetroy/go-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·53 lines (44 loc) · 923 Bytes
/
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
#!/usr/bin/env bash
set -e
downloadFolder=$PWD
version=$1
targets=(
admin
user
resource
customer_service
message_queue
scheduled
)
get_arch() {
a=$(uname -m)
case ${a} in
"x86_64" | "amd64" )
echo "amd64"
;;
"i386" | "i486" | "i586")
echo "386"
;;
*)
echo ${NIL}
;;
esac
}
get_os(){
echo $(uname -s | awk '{print tolower($0)}')
}
main() {
local os=$(get_os)
local arch=$(get_arch)
echo "Download..."
for target in "${targets[@]}"
do
local dest_file="${downloadFolder}/${target}_${os}_${arch}.tar.gz"
local asset_uri="https://github.com/axetroy/go-server/releases/download/${version}/${target}_server_${os}_${arch}.tar.gz"
echo "Downloading ${asset_uri}"
rm -f ${dest_file}
curl --location --output "${dest_file}" "${asset_uri}"
done
exit 0
}
main