forked from 745822558/elm-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elmtool.sh
63 lines (51 loc) · 1.79 KB
/
elmtool.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
CSI=$($echo -e "\033[")
CEND="${CSI}0m"
CYELLOW="${CSI}1;33m"
OUT_ALERT() {
echo -e "${CYELLOW} $1 ${CEND}"
}
DOCKER_INSTALL() {
docker_exists=$(docker version 2>/dev/null)
if [[ ${docker_exists} == "" ]]; then
OUT_ALERT "[✓] 正在安装docker"
curl -fsSL get.docker.com | bash
fi
docker_compose_exists=$(docker-compose version 2>/dev/null)
if [[ ${docker_compose_exists} == "" ]]; then
OUT_ALERT "[✓] 正在安装docker-compose"
curl -L --fail https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose && \
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
fi
}
# SYNC_TIME() {
# OUT_ALERT "[✓] 同步时间中"
# timedatectl set-timezone Asia/Shanghai
# ntpdate pool.ntp.org || htpdate -s www.baidu.com
# hwclock -w
# }
DOCKER_UP() {
chmod +x /etc/elmtool
cd /etc/elmtool
if [ ! -f "/etc/elmtool/docker-compose.yml" ]; then
wget https://ghproxy.com/https://raw.githubusercontent.com/zelang/elm-docker/main/docker-compose.yml -O /etc/elmtool/docker-compose.yml
fi
if [[ $1 == "" ]]; then
wget https://ghproxy.com/https://raw.githubusercontent.com/zelang/elm-docker/main/config.ini -O /etc/elmtool/config.ini
else
wget $1 -O /etc/elmtool/config.ini
fi
docker-compose pull
docker-compose up -d --force-recreate
}
echo -e "欢迎使用饿了么Tool Docker一键部署脚本"
read -p "输入Y/y确认安装 跳过安装请直接回车: " CONFIRM
CONFIRM=${CONFIRM:-"N"}
if [[ ${CONFIRM} == "Y" || ${CONFIRM} == "y" ]];then
if [ ! -d "/etc/elmtool" ]; then
mkdir /etc/elmtool
fi
DOCKER_INSTALL
DOCKER_UP
fi
exit 0