]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/bash -ex |
2 | ############################################ | |
3 | # Helper functions | |
4 | ############################################ | |
5 | function install() { | |
6 | for package in "$@" ; do | |
7 | install_one $package | |
8 | done | |
9 | return 0 | |
10 | } | |
11 | ||
12 | function install_one() { | |
13 | case $(lsb_release -si) in | |
14 | Ubuntu|Debian|Devuan) | |
15 | sudo apt-get install -y --force-yes "$@" | |
16 | ;; | |
17 | CentOS|Fedora|RedHatEnterpriseServer) | |
18 | sudo yum install -y "$@" | |
19 | ;; | |
20 | *SUSE*) | |
21 | sudo zypper --non-interactive install "$@" | |
22 | ;; | |
23 | *) | |
24 | echo "$(lsb_release -si) is unknown, $@ will have to be installed manually." | |
25 | ;; | |
26 | esac | |
27 | } | |
28 | ############################################ | |
29 | # Install required tools | |
30 | ############################################ | |
31 | echo "Install required tools" | |
32 | install git automake | |
33 | ||
34 | CURRENT_PATH=`pwd` | |
35 | ||
36 | ############################################ | |
37 | # Compile&Start RocksDB | |
38 | ############################################ | |
39 | # install prerequisites | |
40 | # for rocksdb | |
41 | case $(lsb_release -si) in | |
42 | Ubuntu|Debian|Devuan) | |
43 | install g++-4.7 libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev librados-dev | |
44 | ;; | |
45 | CentOS|Fedora|RedHatEnterpriseServer) | |
46 | install gcc-c++.x86_64 gflags-devel snappy-devel zlib zlib-devel bzip2 bzip2-devel librados2-devel.x86_64 | |
47 | ;; | |
48 | *) | |
49 | echo "$(lsb_release -si) is unknown, $@ will have to be installed manually." | |
50 | ;; | |
51 | esac | |
52 | ||
53 | # # gflags | |
54 | # sudo yum install gflags-devel | |
55 | # | |
56 | # wget https://github.com/schuhschuh/gflags/archive/master.zip | |
57 | # unzip master.zip | |
58 | # cd gflags-master | |
59 | # mkdir build && cd build | |
60 | # export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 | |
61 | # make && make install | |
62 | ||
63 | # # snappy-devel | |
64 | ||
65 | ||
66 | echo "Compile rocksdb" | |
67 | if [ -e rocksdb ]; then | |
68 | rm -fr rocksdb | |
69 | fi | |
70 | git clone https://github.com/facebook/rocksdb.git | |
71 | ||
72 | # compile code | |
73 | cd rocksdb | |
74 | make env_librados_test ROCKSDB_USE_LIBRADOS=1 -j8 | |
75 | ||
76 | echo "Copy ceph.conf" | |
77 | # prepare ceph.conf | |
78 | mkdir -p ../ceph/src/ | |
79 | if [ -f "/etc/ceph/ceph.conf" ]; then | |
80 | cp /etc/ceph/ceph.conf ../ceph/src/ | |
81 | elif [ -f "/etc/ceph/ceph/ceph.conf" ]; then | |
82 | cp /etc/ceph/ceph/ceph.conf ../ceph/src/ | |
83 | else | |
84 | echo "/etc/ceph/ceph/ceph.conf doesn't exist" | |
85 | fi | |
86 | ||
87 | echo "Run EnvLibrados test" | |
88 | # run test | |
89 | if [ -f "../ceph/src/ceph.conf" ] | |
90 | then | |
91 | cp env_librados_test ~/cephtest/archive | |
92 | ./env_librados_test | |
93 | else | |
94 | echo "../ceph/src/ceph.conf doesn't exist" | |
95 | fi | |
96 | cd ${CURRENT_PATH} |