-
Notifications
You must be signed in to change notification settings - Fork 1
/
check_dependencies.sh
61 lines (50 loc) · 1.68 KB
/
check_dependencies.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
#!/bin/bash
DATACLAYTOOL=tools/dClayTool.sh
GRPCIO="1.22.1"
grn=$'\e[1;32m'
blu=$'\e[1;34m'
end=$'\e[0m'
printMsg() {
#clear
ACCUMMSG=" $ACCUMMSG\n $1"
printf "\n\n ${blu}[dataClay Installer]${end} \n ${grn}$ACCUMMSG${end} \n\n\n"
}
printMsg "Checking dependencies"
# Check Java installed
if ! [ -x "$(command -v java)" ]; then
printMsg "Error: Java not found. Please check it is installed and java command can be run" >&2
exit 1
fi
version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
version1=$(echo "$version" | awk -F. '{printf("%03d%03d",$1,$2);}')
if [[ "$version1" < "001008" ]]; then
printMsg "Error: Java version is not 1.8 or greater. Please install a newer version of Java"
exit 1
fi
# Check python is installed
if ! [ -x "$(command -v python)" ]; then
printMsg "Error: Python not found. Please check it is installed" >&2
exit 1
fi
# Check pip is installed
if ! [ -x "$(command -v pip)" ]; then
printMsg "Error: Pip not found. Please check it is installed" >&2
exit 1
fi
# Check dockers is installed
if ! [ -x "$(command -v docker)" ]; then
printMsg "Error: Docker command not found or not supported. Please check it is installed" >&2
exit 1
fi
# Check docker-compose is installed
if ! [ -x "$(command -v docker-compose)" ]; then
printMsg "Error: Docker-compose not found. Please check it is installed" >&2
exit 1
fi
# Check grpcio dependency
OTHERGRPCIO=`find $HOME/.local -type d | grep grpcio | grep -v $GRPCIO`
if [ "x$OTHERGRPCIO" != "x" ]; then
printMsg "Error: dataClay requires grpcio 1.17.1 but some other versions were found:\n\n $OTHERGRPCIO"
exit 1
fi
printMsg "\n Congratulations! dataClay dependencies are accomplished."