forked from SinKy-Yan/zhenxunbot-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
73 lines (68 loc) · 3.2 KB
/
docker-entrypoint.sh
File metadata and controls
73 lines (68 loc) · 3.2 KB
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
#! /bin/bash
###
# @Author: 源源圆球 1340793687@outlook.com
# @Date: 2022-06-03 22:20:16
# @LastEditors: 源源圆球 1340793687@outlook.com
# @LastEditTime: 2022-06-04 19:40:48
# @FilePath: /docker/files/docker-entrypoint.sh
# @Description: 每次启动容器的时候运行
#
# Copyright (c) 2022 by 源源圆球 1340793687@outlook.com, All Rights Reserved.
###
set -e
if [ -f "/home/config.sh" ];then
bash /home/config.sh
rm -f /home/config.sh
else
echo -e "\033[33m不是第一次运行,不进行设置\033[0m"
fi
if [ -d "/home/zhenxun_bot/extensive_plugin/update" ];then
if [ -f "/home/zhenxun_bot/extensive_plugin/update/session.token" ];then
echo -e "\033[33m检测到新的账号令牌,替换已有账号令牌\033[0m"
cp -rf /home/zhenxun_bot/extensive_plugin/update/session.token /home/zhenxun_bot/extensive_plugin/go-cqhttp/session.token
fi
if [ -f "/home/zhenxun_bot/extensive_plugin/update/device.json" ];then
echo -e "\033[33m检测到新的设备标识,替换已有设备标识\033[0m"
cp -rf /home/zhenxun_bot/extensive_plugin/update/device.json /home/zhenxun_bot/extensive_plugin/go-cqhttp/device.json
fi
if [ -f "/home/zhenxun_bot/extensive_plugin/update/config.yml" ];then
echo -e "\033[33m检测到新的设置文件,替换已有设置文件\033[0m"
cp -rf /home/zhenxun_bot/extensive_plugin/update/config.yml /home/zhenxun_bot/extensive_plugin/go-cqhttp/config.yml
fi
if [ -f "/home/zhenxun_bot/extensive_plugin/update/config.py" ];then
echo -e "\033[33m检测到新的真寻设置文件,替换已有设置文件\033[0m"
cp -rf /home/zhenxun_bot/extensive_plugin/update/config.py /home/zhenxun_bot/configs/config.py
fi
if [ -f "/home/zhenxun_bot/extensive_plugin/update/config.yaml" ];then
echo -e "\033[33m检测到新的真寻插件设置文件,替换已有设置文件\033[0m"
cp -rf /home/zhenxun_bot/extensive_plugin/update/config.yaml /home/zhenxun_bot/configs/config.yaml
fi
mv /home/zhenxun_bot/extensive_plugin/update /home/zhenxun_bot/extensive_plugin/update_old
fi
if [ -d "/home/zhenxun_bot/extensive_plugin/zxfile" ];then
cp -rf /home/zhenxun_bot/extensive_plugin/go-cqhttp/session.token /home/zhenxun_bot/extensive_plugin/zxfile/session.token
cp -rf /home/zhenxun_bot/extensive_plugin/go-cqhttp/device.json /home/zhenxun_bot/extensive_plugin/zxfile/device.json
cp -rf /home/zhenxun_bot/extensive_plugin/go-cqhttp/config.yml /home/zhenxun_bot/extensive_plugin/zxfile/config.yml
cp -rf /home/zhenxun_bot/configs/config.py /home/zhenxun_bot/extensive_plugin/zxfile/config.py
cp -rf /home/zhenxun_bot/configs/config.yaml /home/zhenxun_bot/extensive_plugin/zxfile/config.yaml
fi
/etc/init.d/postgresql start
echo -e "\033[32m✔Postgresql 开始运行\033[0m"
sleep 3s
if [ ! "$GOCQ" ];then
cd /home/zhenxun_bot/extensive_plugin/go-cqhttp
screen -wipe || :
screen -dmS go
screen -x -S go -p 0 -X stuff "
go-cqhttp
"
echo -e "\033[32m✔go-cqhttp 开始运行\033[0m,详细日志请到 ~/extensive_plugin/go-cqhttp/log 查看"
sleep 3s
else
echo -e "\033[33m不启动容器内置go-cqhttp,请自行配置额外的go-cqhttp容器。\033[0m"
fi
cd /home/zhenxun_bot
echo -e "\033[32m✔准备启动 bot\033[0m"
sleep 3s
python /home/zhenxun_bot/bot.py
exec $@