Merge pull request #8515 from dataease/pr@v2_refactor_installer

refactor: 优化安装脚本对本地已有镜像的判断逻辑
This commit is contained in:
fit2cloudrd 2024-03-14 14:38:22 +08:00 committed by GitHub
commit 4dee33972f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,7 @@ if [ -f /usr/bin/dectl ]; then
sed -i -e "s#DE_BASE=.*#DE_BASE=${DE_BASE}#g" dectl
\cp dectl /usr/local/bin && chmod +x /usr/local/bin/dectl
log "停止 DataEase 服务"
if [[ -f /etc/systemd/system/dataease.service ]];then
systemctl stop dataease
else
@ -70,14 +71,6 @@ DE_RUN_BASE=$DE_BASE/dataease2.0
conf_folder=${DE_RUN_BASE}/conf
templates_folder=${DE_RUN_BASE}/templates
if [[ -d $DE_RUN_BASE ]];then
for image in $(grep "image: " $DE_RUN_BASE/docker*.yml | awk -F 'image:' '{print $2}'); do
image_path=$(eval echo $image)
image_name=$(echo $image_path | awk -F "[/]" '{print $3}')
current_images[${#current_images[@]}]=$image_name
done
fi
echo -e "======================= 开始安装 =======================" 2>&1 | tee -a ${CURRENT_DIR}/install.log
mkdir -p ${DE_RUN_BASE}
@ -203,6 +196,11 @@ fi
export COMPOSE_HTTP_TIMEOUT=180
cd ${CURRENT_DIR}
for i in $(docker images --format '{{.Repository}}:{{.Tag}}'); do
current_images[${#current_images[@]}]=${i##*/}
done
# 加载镜像
if [[ -d images ]]; then
log "加载镜像"