-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgrps_client_install.sh
67 lines (61 loc) · 1.32 KB
/
grps_client_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
#!/bin/bash
# Copyright 2023 netease. All rights reserved.
# Author [email protected]
# Date 2023/8/25
# Brief Grps install.
COLORRED="\033[31m"
COLORGREEN="\033[32m"
COLORYELLOW="\033[33m"
COLOREND="\033[0m"
function LOG() {
date_str=$(date "+%Y-%m-%d %H:%M:%S")
case "$1" in
"WARNING")
shift
echo -e "${COLORYELLOW}WARNING $(date "+%Y-%m-%d %H:%M:%S") $* $COLOREND"
;;
"ERROR")
shift
echo -e "${COLORRED}ERROR $(date "+%Y-%m-%d %H:%M:%S") $* $COLOREND"
;;
*)
echo -e "${COLORGREEN}INFO $(date "+%Y-%m-%d %H:%M:%S") $* $COLOREND"
;;
esac
}
function check_ret() {
if [ $? -ne 0 ]; then
LOG ERROR "$1 failed."
exit 1
fi
}
function run_and_check() {
$*
check_ret "$*"
}
# check if is root.
if [ "$EUID" -ne 0 ]; then
LOG ERROR "Please run as root."
exit
fi
arg1=$1
if [ "$arg1" = "--skip_deps" ]; then
LOG INFO "Skip install dependencies."
else
LOG INFO "Installing dependencies..."
cd deps
run_and_check bash install.sh 1 1 1
cd ..
if [ $? -ne 0 ]; then
LOG ERROR "Install dependencies failed."
exit 1
fi
LOG INFO "Dependencies install success."
fi
LOG INFO "Building grps apis..."
cd ./apis/grps_apis/
run_and_check bash py_install.sh
run_and_check bash cpp_install.sh
run_and_check bash java_install.sh
cd -
LOG INFO "Build grps apis done."