forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_dep.sh
executable file
·153 lines (135 loc) · 3.9 KB
/
build_dep.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
#
# Copyright (c) 2019 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
#
# step 1: ./build_dep.sh [N] # N: no need packages
# step 2: source ~/.bashrc
#
DIR=/tmp/download
mkdir $DIR
trap "rm -fr $DIR" EXIT
url_addr=https://nebula-graph.oss-accelerate.aliyuncs.com/third-party
no_deps=0
[[ $1 == N ]] && no_deps=1
function yum_install {
# clean the installed third-party
result=`rpm -qa | grep vs-nebula-3rdparty | wc -l`
if [[ $result -ne 0 ]]; then
echo "#### vs-nebula-3rdparty have been installed, uninstall it firstly ####"
sudo rpm -e vs-nebula-3rdparty
fi
sudo yum -y install wget \
make \
glibc-devel \
m4 \
perl-WWW-Curl \
ncurses-devel \
readline-devel \
maven \
java-1.8.0-openjdk \
unzip
# feroda and centos7 has it
if [[ $1 == 1 || $1 == 2 ]]; then
sudo yum -y install perl-Data-Dumper
fi
if [[ $1 == 3 ]]; then
sudo yum -y install perl-YAML \
perl-CGI \
perl-DBI \
perl-Pod-Simple
fi
installPackage $1
addAlias $1
return 0
}
function aptget_install {
# clean the installed third-party
result=`dpkg -l | grep vs-nebula-3rdparty | wc -l`
if [[ $result -ne 0 ]]; then
echo "#### vs-nebula-3rdparty have been installed, uninstall it firstly ####"
sudo dpkg -P vs-nebula-3rdparty
fi
sudo apt-get -y install wget \
make \
gcc-multilib \
m4 \
libncurses5-dev \
libreadline-dev \
python \
maven \
openjdk-8-jdk \
unzip
installPackage $1
addAlias $1
return 0
}
function installPackage {
versions=(empty fedora29 centos7.5 centos6.5 ubuntu18 ubuntu16)
package_name=${versions[$1]}
echo "###### start install dep in $package_name ######"
[[ $package_name = empty ]] && return 0
[[ ! -n $package_name ]] && return 0
if [[ no_deps -eq 0 ]]; then
echo "###### There is no need to rely on packages ######"
cd $DIR
wget ${url_addr}/${package_name}.tar.gz
tar xf ${package_name}.tar.gz
cd ${package_name}
./install.sh
fi
return 0
}
function addAlias {
echo "export PATH=/opt/nebula/third-party/bin:\$PATH" >> ~/.bashrc
echo "export ACLOCAL_PATH=/opt/nebula/third-party/share/aclocal-1.15:/opt/nebula/third-party/share/aclocal" >> ~/.bashrc
echo "alias cmake='/opt/nebula/third-party/bin/cmake -DCMAKE_C_COMPILER=/opt/nebula/third-party/bin/gcc -DCMAKE_CXX_COMPILER=/opt/nebula/third-party/bin/g++'" >> ~/.bashrc
echo "alias ctest='/opt/nebula/third-party/bin/ctest'" >> ~/.bashrc
if [[ $1 == 4 || $1 == 5 ]]; then
echo "export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:\$LIBRARY_PATH" >> ~/.bashrc
fi
return 0
}
# fedora29:1, centos7.5:2, centos6.5:3, ubuntu18:4, ubuntu16:5
function getSystemVer {
if [[ -e /etc/redhat-release ]]; then
if [[ -n `cat /etc/redhat-release|grep Fedora` ]]; then
echo 1
elif [[ -n `cat /etc/redhat-release|grep "release 7."` ]]; then
echo 2
elif [[ -n `cat /etc/redhat-release|grep "release 6."` ]]; then
echo 3
else
echo 0
fi
elif [[ -e /etc/issue ]]; then
result=`cat /etc/issue|cut -d " " -f 2 |cut -d "." -f 1`
if [[ result -eq 18 ]]; then
echo 4
elif [[ result -eq 16 ]]; then
echo 5
else
echo 0
fi
else
echo 0
fi
}
version=$(getSystemVer)
set -e
case $version in
1|2|3)
yum_install $version
;;
4|5)
aptget_install $version
;;
*)
echo "unknown system"
exit -1
;;
esac
echo "###### install succeed ######"
exit 0