forked from oceanbase/obdeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
30 lines (27 loc) · 914 Bytes
/
build.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
# /bin/bash
if [ `id -u` != 0 ] ; then
echo "Please use root to run"
fi
obd_dir=`dirname $0`
python_bin='/usr/bin/python'
python_path=`whereis python`
for bin in ${python_path[@]}; do
if [ -x $bin ]; then
python_bin=$bin
break 1
fi
done
read -p "Enter python path [default $python_bin]:"
if [ "x$REPLY" != "x" ]; then
python_bin=$REPLY
fi
rm -fr /usr/obd && mkdir -p /usr/obd
cp -r -d $obd_dir/* /usr/obd
cd /usr/obd/plugins && ln -sf oceanbase oceanbase-ce
cp -f /usr/obd/profile/obd.sh /etc/profile.d/obd.sh
rm -fr /usr/obd/mirror/remote && mkdir -p /usr/obd/mirror/remote
cd /usr/obd/mirror/remote && wget http://yum.tbsite.net/mirrors/oceanbase/OceanBase.repo
rm -fr /usr/bin/obd
echo -e "# /bin/bash\n$python_bin /usr/obd/_cmd.py \$*" > /usr/bin/obd
chmod +x /usr/bin/obd
echo -e 'Installation of obd finished successfully\nPlease source /etc/profile.d/obd.sh to enable it'