-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·101 lines (85 loc) · 2.81 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
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
#!/usr/bin/env bash
set -e +o pipefail
show_help() {
cat << EOF
MinKV Simple KV Database
-h Display this help and exit
-V VERSION Custom Software 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=v"$OPTARG"
;;
*)
echo -e "Unexpected flag not supported"
exit 1
;;
esac
done
fi
echo -e "
............888888888888888= ......................... =888888888888888D.............
...........O88888888888888 .............................. D88888888888888............
..........D888888888888ZI: ............................... Z88D8888888888D...........
.........+88888888 ......................................... 8888888888888D..........
.........+88888888 .......... Simple KV Database ........... O88888888888D..........
.........+88888888 .... .... O88888888888D..........
.........+88888888 ..... https://github.com/cfanbo/minkv .... O88888888888D..........
.........+88888888D.......................................... +88888888888D..........
..........D888888888888O+ ................................ ?D888888888888O...........
...........O88888888888888 .............................. O88888888888888............
...........:D888888888888888 .......................... D888888888888888.............
"
echo $VERSION;
if [[ -n "${CLI_ON_MACOS-}" ]]
then
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "${UNAME_MACHINE}" == "arm64" || "${UNAME_MACHINE}" == "aarch64" ]]
then
curl -O -fsSL https://githubfiles.oss-cn-shanghai.aliyuncs.com/minkv/minkv-"$VERSION"-aarch64-apple-darwin.tar.gz
tar zxf minkv-"$VERSION"-aarch64-apple-darwin.tar.gz
else
curl -O -fsSL https://githubfiles.oss-cn-shanghai.aliyuncs.com/minkv/minkv-"$VERSION"-x86_64-apple-darwin.tar.gz
tar zxf minkv-"$VERSION"-x86_64-apple-darwin.tar.gz
fi
mv ./minkv /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://githubfiles.oss-cn-shanghai.aliyuncs.com/minkv/minkv-"$VERSION"-aarch64-unknown-linux-gnu.tar.gz
tar zxf minkv-"$VERSION"-aarch64-unknown-linux-gnu.tar.gz
else
curl -O -fsSL https://githubfiles.oss-cn-shanghai.aliyuncs.com/minkv/minkv-"$VERSION"-x86_64-unknown-linux-gnu.tar.gz
tar zxf minkv-"$VERSION"-x86_64-unknown-linux-gnu.tar.gz
fi
mv ./minkv /usr/local/bin/
fi