From 16dc2692d8bd664d3b121582edcfabc44eef2038 Mon Sep 17 00:00:00 2001 From: xuwei-fit2cloud Date: Wed, 7 Feb 2024 15:20:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=20installer=20?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=95=9C=E5=83=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/dataease/install.sh | 21 +++++++++++++++++---- installer/dataease/uninstall.sh | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/installer/dataease/install.sh b/installer/dataease/install.sh index ea2c763095..8d30efacad 100755 --- a/installer/dataease/install.sh +++ b/installer/dataease/install.sh @@ -21,7 +21,8 @@ INSTALL_TYPE='install' if [ -f /usr/bin/dectl ]; then # 获取已安装的 DataEase 的运行目录 DE_BASE=$(grep "^DE_BASE=" /usr/bin/dectl | cut -d'=' -f2) - dectl uninstall + echo "停止 DataEase 服务" + service dataease stop INSTALL_TYPE='upgrade' fi @@ -45,6 +46,14 @@ fi dataease_conf=${conf_folder}/dataease.properties +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 + function prop { [ -f "$1" ] | grep -P "^\s*[^#]?${2}=.*$" $1 | cut -d'=' -f2 } @@ -305,7 +314,11 @@ if [[ -d images ]]; then continue fi fi - docker load -i images/$i 2>&1 | tee -a ${CURRENT_DIR}/install.log + if [[ "${current_images[@]}" =~ "${i%.tar.gz}" ]]; then + echo "本地已存在镜像 ${i%.tar.gz},略过加载" + else + docker load -i images/$i 2>&1 | tee -a ${CURRENT_DIR}/install.log + fi done else log "拉取镜像" @@ -317,9 +330,9 @@ else fi if which chkconfig >/dev/null 2>&1;then - chkconfig dataease >/dev/null + chkconfig dataease >/dev/null 2>&1 if [ $? -eq 0 ]; then - chkconfig --del dataease + chkconfig --del dataease >/dev/null 2>&1 fi fi diff --git a/installer/dataease/uninstall.sh b/installer/dataease/uninstall.sh index 165558365e..b138b5e193 100644 --- a/installer/dataease/uninstall.sh +++ b/installer/dataease/uninstall.sh @@ -24,7 +24,7 @@ service dataease stop >/dev/null 2>&1 echo "移除 DataEase 服务" if which chkconfig >/dev/null 2>&1;then - chkconfig dataease >/dev/null + chkconfig dataease >/dev/null 2>&1 if [ $? -eq 0 ]; then chkconfig --del dataease >/dev/null 2>&1 fi