forked from Tencent/phxsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoinstall.sh
executable file
·105 lines (92 loc) · 2.05 KB
/
autoinstall.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
#!/bin/bash
base_dir=`pwd`
make_file_tools=$base_dir/tools/create_makefile.py
check_env_tools=$base_dir/tools/check_install.py
src_dir=$base_dir/src_list
function check_env(){
echo "[check environment status]..."
python $check_env_tools $base_dir
if [ $? -gt 0 ];
then
exit 1
fi
echo "[check environment status ok]"
}
function create_makefile(){
python $make_file_tools $base_dir $1
}
function scandir(){
if [ $1 ];then
echo "[creating makefile] $1"
create_makefile $1
for file in `ls $1`
do
if ([ -d $1"/"$file ] && [ "$file" != "glog" ])
then
scandir $1"/"$file
fi
done
fi
}
function install_mysql(){
cd percona
rm plugin/phxsync_phxrpc -rf
cmake . -DCMAKE_INSTALL_PREFIX=$base_dir/percona -DCMAKE_BUILD_TYPE=Release -DWITH_EMBEDDED_SERVER=OFF
make perconaserverclient
cd -
cp phx_percona/percona/plugin/phxsync_phxrpc percona/plugin -r
cp phx_percona/percona/sql/* percona/sql/ -r
cp phx_percona/percona/plugin/semisync/semisync_master_plugin.cc percona/plugin/semisync/semisync_master_plugin.cc
cd percona
cmake . -DCMAKE_INSTALL_PREFIX=$base_dir/percona -DCMAKE_BUILD_TYPE=Release -DWITH_EMBEDDED_SERVER=OFF -DWITH_PHXSYNC_MASTER_PHXRPC=1
cd -
echo "[install mysql] done"
}
function process(){
create_makefile $base_dir
res=`cat $src_dir`
echo $res
for file in $res
do
if ([ -d $base_dir"/"$file ] && [ "$file" != "glog" ])
then
scandir $base_dir"/"$file
fi
done
install_mysql
}
function showusage(){
echo "Configuration:"
echo " -h, --help display this help and exit"
echo "Installation directories:"
echo " --prefix=PREFIX install architecture-independent files in PREFIX"
echo " [.]"
exit
}
prefix=
ARGS=`getopt -o h -l prefix:,help -- "$@"`
eval set -- "${ARGS}"
while true
do
case "$1" in
--prefix)
if [ $2 ]; then
sed -i -r "s#PREFIX=.*#PREFIX=$2#" makefile.mk
fi
shift
;;
-h|--help)
showusage
break
;;
--)
shift
break
;;
esac
shift
done
check_env
if [ $? -eq 0 ]; then
process
fi