diff --git a/funs.sh b/funs.sh index 5a3017e..63743b2 100644 --- a/funs.sh +++ b/funs.sh @@ -244,11 +244,11 @@ upgradeMacheteInContainers () { name=$1 if [ "${name}" == "album" ]; then - docker exec -it machete_album /var/www/machete/bin/upgrade.sh docker container cp template/custom_config_beauty.json machete_album:/var/www/machete/runtime/custom_config.json + docker exec -it machete_album /var/www/machete/bin/upgrade.sh else - docker exec -it machete_vlog /var/www/machete/bin/upgrade.sh docker container cp template/custom_config_videoblog.json machete_vlog:/var/www/machete/runtime/custom_config.json + docker exec -it machete_vlog /var/www/machete/bin/upgrade.sh fi } diff --git a/upgrade.sh b/upgrade.sh index de083ec..eb471c5 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -3,13 +3,43 @@ # 引入公用方法 . ./funs.sh -container=$1 -if [ -z "${container}" ]; then - container="album" -fi +detect_domain='git.filesite.io' +echo "正在检测是否能连接[${detect_domain}],请稍后..." +detectDomainCanConnect "${detect_domain}" +connect_res=$? +if [ $connect_res -eq 0 ]; then + echo "⚠️⚠️" + echo "当前网络无法连接[${detect_domain}],请参考下面方法解决" + nslookup "${detect_domain}" -# ===== 升级machete ===== -upgradeMacheteInContainers "${container}" + echo "" + echo "根据上面的dns解析结果,如果看到有多个ip地址,请根据目前ping的结果,来修改容器/etc/hosts配置${detect_domain}走另一个ip" + ping -c 2 "${detect_domain}" -echo "系统已升级到最新版" -echo "" \ No newline at end of file + echo "" + echo "hosts文件dns配置格式为:ip+空格+${detect_domain}" + echo "示例:104.21.55.95 git.filesite.io" + echo "" + + echo "" + echo "进入容器修改hosts文件的步骤:" + echo "1. 命令行执行:docker exec -it machete_album /bin/sh" + echo "2. 在容器里用vi打开/etc/hosts文件,加入域名解析配置:vi /etc/hosts" + echo "3. 修改并保存hosts文件后按ctrl + d退出容器" + echo "" + + read -p "已经完成hosts配置,继续升级代码吗?(Y/N): " confirm + if [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]; then + docker exec -it machete_album /var/www/machete/bin/upgrade.sh + + echo "系统已升级到最新版" + echo "" + fi + +else + # ===== 升级machete ===== + docker exec -it machete_album /var/www/machete/bin/upgrade.sh + + echo "系统已升级到最新版" + echo "" +fi \ No newline at end of file