forked from goodrain/rainbond-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·72 lines (63 loc) · 1.69 KB
/
install.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
#!/bin/bash
#======================================================================================================================
#
# FILE: install.sh
#
# DESCRIPTION: Install
#
# BUGS: https://github.com/goodrain/rainbond-install/issues
#
# COPYRIGHT: (c) 2018 by the Goodrain Delivery Team.
#
# LICENSE: Apache 2.0
# CREATED: 03/30/2018 10:49:37 AM
#======================================================================================================================
[[ $DEBUG ]] && set -x
REPO_URL="https://github.com/goodrain/rainbond-install.git"
which_cmd() {
which "${1}" 2>/dev/null || \
command -v "${1}" 2>/dev/null
}
check_cmd() {
which_cmd "${1}" >/dev/null 2>&1 && return 0
return 1
}
APT="$(which_cmd apt)"
YUM="$(which_cmd yum)"
pkg(){
echo "Install the prerequisite packages..."
if [ ! -z "$YUM" ];then
yum makecache -q
yum install -y -q ntpdate tar git wget perl tree nload curl telnet bind-utils htop dstat net-tools lsof iproute rsync lvm2 bash-completion
else
apt update -q
apt install -y -q git ntpdate wget curl tar lsof htop nload rsync net-tools telnet iproute2 lvm2 tree systemd
fi
echo "update localtime"
ntpdate 0.cn.pool.ntp.org
}
run(){
pkg
[ -d "$PWD/rainbond-install" ] && rm -rf $PWD/rainbond-install
git clone --depth 1 ${REPO_URL}
cd rainbond-install
if [[ $1 == "help" ]];then
./setup.sh
echo "cd $PWD; ./setup.sh <args>"
elif [[ $1 == "dev" ]];then
./setup.sh dev
else
./setup.sh install
fi
}
case $1 in
dev)
run dev
;;
help)
run help
;;
* )
run
;;
esac