From 63b2135b1cad24335542226a54fa0d523c85710a Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 11:42:25 +0800 Subject: [PATCH 1/6] test: modify checkpackages scritps --- packaging/testpackage.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index 758c554178..b300041e29 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -130,12 +130,12 @@ elif [[ ${packgeName} =~ "tar" ]];then echo "check installPackage File" + + cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile + cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile + cd ${installPath} - - tree ${oriInstallPath}/${originTdpPath} > ${oriInstallPath}/${originPackageName}_checkfile - tree ${installPath}/${tdPath} > ${installPath}/${packgeName}_checkfile - - diff ${installPath}/${packgeName}_checkfile ${oriInstallPath}/${originPackageName}_checkfile > ${installPath}/diffFile.log + diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log diffNumbers=`cat ${installPath}/diffFile.log |wc -l ` if [ ${diffNumbers} != 0 ];then echo "The number and names of files have changed from the previous installation package" From a76cd4601024447edfb06ad91a06421d1143171a Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 11:46:51 +0800 Subject: [PATCH 2/6] test: modify checkpackages scritps --- packaging/testpackage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index b300041e29..d2ee0cad0b 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -115,7 +115,7 @@ elif [[ ${packgeName} =~ "rpm" ]];then elif [[ ${packgeName} =~ "tar" ]];then cd ${oriInstallPath} if [ ! -f {originPackageName} ];then - sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${originversion}/community${originPackageName} . + sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${originversion}/community/${originPackageName} . fi echo "tar -xvf ${originPackageName}" && tar -xvf ${originPackageName} From d59edad61046b387f889ea0914c523d00b452c52 Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 11:52:14 +0800 Subject: [PATCH 3/6] test: modify checkpackages scritps --- packaging/testpackage.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index d2ee0cad0b..5332f84ddb 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -111,7 +111,9 @@ if [[ ${packgeName} =~ "deb" ]];then fi elif [[ ${packgeName} =~ "rpm" ]];then cd ${installPath} - echo "rpm ${packgeName}" && rpm -ivh ${packgeName} --quiet + sudo rpm -e tdengine + sudo rpm -e taostools + echo "rpm -ivh ${packgeName} --quiet " && rpm -ivh ${packgeName} --quiet elif [[ ${packgeName} =~ "tar" ]];then cd ${oriInstallPath} if [ ! -f {originPackageName} ];then From 8c0e46974bc599cce58acd0d33dd6f9202233baf Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 17:46:57 +0800 Subject: [PATCH 4/6] test: modify checkpackages scritps of rpm --- packaging/testpackage.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index 5332f84ddb..31840f2e6b 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -1,5 +1,6 @@ #!/bin/sh +scriptDir=$(dirname $(readlink -f $0)) packgeName=$1 version=$2 @@ -86,14 +87,24 @@ echo "download installPackage" # wget https://www.taosdata.com/assets-download/3.0/${originPackageName} cd ${installPath} +cp if [ ! -f {packgeName} ];then sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} . fi + +packageSuffix=`echo {packgeName} | awk -F '.' '{print $NF}'` + +cp -r ${scriptDir}/debAuto.sh if [ ! -f debAuto.sh ];then echo '#!/usr/bin/expect ' > debAuto.sh + echo 'set packgeName [lindex $argv 0]' >> debAuto.sh + echo 'set packageSuffix [lindex $argv 1]' >> debAuto.sh echo 'set timeout 3 ' >> debAuto.sh - echo 'pset packgeName [lindex $argv 0]' >> debAuto.sh - echo 'spawn dpkg -i ${packgeName}' >> debAuto.sh + echo 'if { ${packageSuffix} == "deb" } {' >> debAuto.sh + echo ' spawn dpkg -i ${packgeName} ' >> debAuto.sh + echo '} elseif { ${packageSuffix} == "rpm"} {' >> debAuto.sh + echo ' spawn rpm -ivh ${packgeName}' >> debAuto.sh + echo '}' >> debAuto.sh echo 'expect "*one:"' >> debAuto.sh echo 'send "\r"' >> debAuto.sh echo 'expect "*skip:"' >> debAuto.sh @@ -105,7 +116,7 @@ if [[ ${packgeName} =~ "deb" ]];then dpkg -r taostools dpkg -r tdengine if [[ ${packgeName} =~ "TDengine" ]];then - echo "./debAuto.sh ${packgeName}" && chmod 755 debAuto.sh && ./debAuto.sh ${packgeName} + echo "./debAuto.sh ${packgeName}" && chmod 755 debAuto.sh && ./debAuto.sh ${packgeName} ${packageSuffix} else echo "dpkg -i ${packgeName}" && dpkg -i ${packgeName} fi From fca5b0459edd40cb3b38781d5fc435ee3b21f911 Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 17:58:39 +0800 Subject: [PATCH 5/6] test: modify checkpackages scritps of rpm and deb --- packaging/debRpmAutoInstall.sh | 13 ++++++++++ packaging/testpackage.sh | 44 +++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 19 deletions(-) create mode 100755 packaging/debRpmAutoInstall.sh diff --git a/packaging/debRpmAutoInstall.sh b/packaging/debRpmAutoInstall.sh new file mode 100755 index 0000000000..1f51378c91 --- /dev/null +++ b/packaging/debRpmAutoInstall.sh @@ -0,0 +1,13 @@ +#!/usr/bin/expect +set packgeName [lindex $argv 0] +set packageSuffix [lindex $argv 1] +set timeout 3 +if { ${packageSuffix} == "deb" } { + spawn dpkg -i ${packgeName} +} elseif { ${packageSuffix} == "rpm"} { + spawn rpm -ivh ${packgeName} +} +expect "*one:" +send "\r" +expect "*skip:" +send "\r" diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index 31840f2e6b..60acaf7b8d 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -87,28 +87,30 @@ echo "download installPackage" # wget https://www.taosdata.com/assets-download/3.0/${originPackageName} cd ${installPath} -cp +cp -r ${scriptDir}/debRpmAutoInstall.sh . + if [ ! -f {packgeName} ];then + echo "sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} ." sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} . fi -packageSuffix=`echo {packgeName} | awk -F '.' '{print $NF}'` +packageSuffix=$(echo ${packgeName} | awk -F '.' '{print $NF}') -cp -r ${scriptDir}/debAuto.sh -if [ ! -f debAuto.sh ];then - echo '#!/usr/bin/expect ' > debAuto.sh - echo 'set packgeName [lindex $argv 0]' >> debAuto.sh - echo 'set packageSuffix [lindex $argv 1]' >> debAuto.sh - echo 'set timeout 3 ' >> debAuto.sh - echo 'if { ${packageSuffix} == "deb" } {' >> debAuto.sh - echo ' spawn dpkg -i ${packgeName} ' >> debAuto.sh - echo '} elseif { ${packageSuffix} == "rpm"} {' >> debAuto.sh - echo ' spawn rpm -ivh ${packgeName}' >> debAuto.sh - echo '}' >> debAuto.sh - echo 'expect "*one:"' >> debAuto.sh - echo 'send "\r"' >> debAuto.sh - echo 'expect "*skip:"' >> debAuto.sh - echo 'send "\r" ' >> debAuto.sh + +if [ ! -f debRpmAutoInstall.sh ];then + echo '#!/usr/bin/expect ' > debRpmAutoInstall.sh + echo 'set packgeName [lindex $argv 0]' >> debRpmAutoInstall.sh + echo 'set packageSuffix [lindex $argv 1]' >> debRpmAutoInstall.sh + echo 'set timeout 3 ' >> debRpmAutoInstall.sh + echo 'if { ${packageSuffix} == "deb" } {' >> debRpmAutoInstall.sh + echo ' spawn dpkg -i ${packgeName} ' >> debRpmAutoInstall.sh + echo '} elseif { ${packageSuffix} == "rpm"} {' >> debRpmAutoInstall.sh + echo ' spawn rpm -ivh ${packgeName}' >> debRpmAutoInstall.sh + echo '}' >> debRpmAutoInstall.sh + echo 'expect "*one:"' >> debRpmAutoInstall.sh + echo 'send "\r"' >> debRpmAutoInstall.sh + echo 'expect "*skip:"' >> debRpmAutoInstall.sh + echo 'send "\r" ' >> debRpmAutoInstall.sh fi if [[ ${packgeName} =~ "deb" ]];then @@ -116,7 +118,7 @@ if [[ ${packgeName} =~ "deb" ]];then dpkg -r taostools dpkg -r tdengine if [[ ${packgeName} =~ "TDengine" ]];then - echo "./debAuto.sh ${packgeName}" && chmod 755 debAuto.sh && ./debAuto.sh ${packgeName} ${packageSuffix} + echo "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} else echo "dpkg -i ${packgeName}" && dpkg -i ${packgeName} fi @@ -124,7 +126,11 @@ elif [[ ${packgeName} =~ "rpm" ]];then cd ${installPath} sudo rpm -e tdengine sudo rpm -e taostools - echo "rpm -ivh ${packgeName} --quiet " && rpm -ivh ${packgeName} --quiet + if [[ ${packgeName} =~ "TDengine" ]];then + echo "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} + else + echo "rpm -ivh ${packgeName}" && rpm -ivh ${packgeName} + fi elif [[ ${packgeName} =~ "tar" ]];then cd ${oriInstallPath} if [ ! -f {originPackageName} ];then From f6c2cce5d023274dbaad34d2af38737e764c401c Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 31 Aug 2022 19:53:40 +0800 Subject: [PATCH 6/6] test: modify checkpackages scritps of client --- packaging/MPtestJenkinsfile | 60 ++++++++++--- packaging/testpackage.sh | 173 +++++++++++++++++++++++------------- 2 files changed, 157 insertions(+), 76 deletions(-) diff --git a/packaging/MPtestJenkinsfile b/packaging/MPtestJenkinsfile index 45c8d8abf2..be49fb44be 100644 --- a/packaging/MPtestJenkinsfile +++ b/packaging/MPtestJenkinsfile @@ -64,6 +64,11 @@ pipeline { defaultValue:'2.1.2', description: 'This number of baseVerison is generally not modified.Now it is 3.0.0.1' ) + string ( + name:'nasPassword', + defaultValue:'password', + description: 'the pasword of the NAS server which has installPackage-192.168.1.131' + ) } environment{ WORK_DIR = '/var/lib/jenkins/workspace' @@ -111,17 +116,17 @@ pipeline { sync_source("${BRANCH_NAME}") sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' } @@ -134,17 +139,22 @@ pipeline { sync_source("${BRANCH_NAME}") sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_DEB} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_DEB} ${version} ${BASE_TD_SERVER_DEB} ${baseVersion} server ${nasPassword} + python3 checkPackageRuning.py + ''' + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging + bash testpackage.sh ${TD_CLIENT_TAR} ${version} ${BASE_TD_CLIENT_TAR} ${baseVersion} client ${nasPassword} python3 checkPackageRuning.py ''' } @@ -157,17 +167,17 @@ pipeline { sync_source("${BRANCH_NAME}") sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' } @@ -179,18 +189,42 @@ pipeline { timeout(time: 30, unit: 'MINUTES'){ sync_source("${BRANCH_NAME}") sh ''' - cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + cd ${TDENGINE_ROOT_DIR}/packaging + bash testpackage.sh ${TD_SERVER_TAR} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_LITE_TAR} ${version} ${BASE_TD_SERVER_LITE_TAR} ${baseVersion} server ${nasPassword} python3 checkPackageRuning.py ''' sh ''' cd ${TDENGINE_ROOT_DIR}/packaging - bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server + bash testpackage.sh ${TD_SERVER_RPM} ${version} ${BASE_TD_SERVER_TAR} ${baseVersion} server ${nasPassword} + python3 checkPackageRuning.py + ''' + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging + bash testpackage.sh ${TD_CLIENT_LITE_TAR} ${version} ${BASE_TD_CLIENT_LITE_TAR} ${baseVersion} client ${nasPassword} + python3 checkPackageRuning.py + ''' + } + } + } + + stage('arm64') { + agent{label 'linux_arm64'} + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging + bash testpackage.sh ${TD_SERVER_ARM_TAR} ${version} ${BASE_TD_SERVER_ARM_TAR} ${baseVersion} server ${nasPassword} + python3 checkPackageRuning.py + ''' + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging + bash testpackage.sh ${TD_CLIENT_ARM_TAR} ${version} ${BASE_TD_CLIENT_ARM_TAR} ${baseVersion} client ${nasPassword} python3 checkPackageRuning.py ''' } diff --git a/packaging/testpackage.sh b/packaging/testpackage.sh index 60acaf7b8d..512e7a7e4e 100755 --- a/packaging/testpackage.sh +++ b/packaging/testpackage.sh @@ -1,7 +1,6 @@ #!/bin/sh - +#parameter scriptDir=$(dirname $(readlink -f $0)) - packgeName=$1 version=$2 originPackageName=$3 @@ -10,6 +9,17 @@ testFile=$5 subFile="taos.tar.gz" password=$6 +# Color setting +RED='\033[41;30m' +GREEN='\033[1;32m' +YELLOW='\033[1;33m' +BLUE='\033[1;34m' +GREEN_DARK='\033[0;32m' +YELLOW_DARK='\033[0;33m' +BLUE_DARK='\033[0;34m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' + if [ ${testFile} = "server" ];then tdPath="TDengine-server-${version}" originTdpPath="TDengine-server-${originversion}" @@ -25,62 +35,87 @@ elif [ ${testFile} = "tools" ];then fi function cmdInstall { -comd=$1 -if command -v ${comd} ;then - echo "${comd} is already installed" +command=$1 +if command -v ${command} ;then + echoColor YD "${command} is already installed" else if command -v apt ;then - apt-get install ${comd} -y + apt-get install ${command} -y elif command -v yum ;then - yum -y install ${comd} - echo "you should install ${comd} manually" + yum -y install ${command} + echoColor YD "you should install ${command} manually" fi fi } +function echoColor { +color=$1 +command=$2 -echo "Uninstall all components of TDeingne" - -if command -v rmtaos ;then - echo "uninstall all components of TDeingne:rmtaos" - rmtaos -else - echo "os doesn't include TDengine " +if [ ${color} = 'Y' ];then + echo -e "${YELLOW}${command}${NC}" +elif [ ${color} = 'YD' ];then + echo -e "${YELLOW_DARK}${command}${NC}" +elif [ ${color} = 'R' ];then + echo -e "${RED}${command}${NC}" +elif [ ${color} = 'G' ];then + echo -e "${GREEN}${command}${NC}\r\n" +elif [ ${color} = 'B' ];then + echo -e "${BLUE}${command}${NC}" +elif [ ${color} = 'BD' ];then + echo -e "${BLUE_DARK}${command}${NC}" fi +} -if command -v rmtaostools ;then - echo "uninstall all components of TDeingne:rmtaostools" - rmtaostools -else - echo "os doesn't include rmtaostools " -fi +echoColor G "===== install basesoft =====" cmdInstall tree cmdInstall wget cmdInstall sshpass -echo "new workroom path" +echoColor G "===== Uninstall all components of TDeingne =====" + +if command -v rmtaos ;then + echoColor YD "uninstall all components of TDeingne:rmtaos" + rmtaos +else + echoColor YD "os doesn't include TDengine" +fi + +if command -v rmtaostools ;then + echoColor YD "uninstall all components of TDeingne:rmtaostools" + rmtaostools +else + echoColor YD "os doesn't include rmtaostools " +fi + + + + +echoColor G "===== new workroom path =====" installPath="/usr/local/src/packageTest" oriInstallPath="/usr/local/src/packageTest/3.1" if [ ! -d ${installPath} ] ;then + echoColor BD "mkdir -p ${installPath}" mkdir -p ${installPath} else - echo "${installPath} already exists" + echoColor YD "${installPath} already exists" fi if [ ! -d ${oriInstallPath} ] ;then + echoColor BD "mkdir -p ${oriInstallPath}" mkdir -p ${oriInstallPath} else - echo "${oriInstallPath} already exists" + echoColor YD "${oriInstallPath} already exists" fi -echo "download installPackage" +echoColor G "===== download installPackage =====" # cd ${installPath} # wget https://www.taosdata.com/assets-download/3.0/${packgeName} # cd ${oriInstallPath} @@ -90,7 +125,7 @@ cd ${installPath} cp -r ${scriptDir}/debRpmAutoInstall.sh . if [ ! -f {packgeName} ];then - echo "sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} ." + echoColor BD "sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} ." sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/${packgeName} . fi @@ -113,43 +148,57 @@ if [ ! -f debRpmAutoInstall.sh ];then echo 'send "\r" ' >> debRpmAutoInstall.sh fi + +echoColor G "===== instal Package =====" + if [[ ${packgeName} =~ "deb" ]];then cd ${installPath} dpkg -r taostools dpkg -r tdengine if [[ ${packgeName} =~ "TDengine" ]];then - echo "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} + echoColor BD "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} else - echo "dpkg -i ${packgeName}" && dpkg -i ${packgeName} + echoColor BD "dpkg -i ${packgeName}" && dpkg -i ${packgeName} fi elif [[ ${packgeName} =~ "rpm" ]];then cd ${installPath} sudo rpm -e tdengine sudo rpm -e taostools if [[ ${packgeName} =~ "TDengine" ]];then - echo "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} + echoColor BD "./debRpmAutoInstall.sh ${packgeName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packgeName} ${packageSuffix} else - echo "rpm -ivh ${packgeName}" && rpm -ivh ${packgeName} + echoColor BD "rpm -ivh ${packgeName}" && rpm -ivh ${packgeName} fi elif [[ ${packgeName} =~ "tar" ]];then + cd ${installPath}/${tdPath} + if [ ${testFile} = "server" ];then + echoColor BD "bash ${installCmd} -e no " + bash ${installCmd} -e no + else + echoColor BD "bash ${installCmd} " + bash ${installCmd} + fi + + echoColor G "===== check installPackage File of tar =====" + cd ${oriInstallPath} if [ ! -f {originPackageName} ];then + echoColor YD "download base installPackage" + echoColor BD "sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${originversion}/community/${originPackageName} ." sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${originversion}/community/${originPackageName} . fi - echo "tar -xvf ${originPackageName}" && tar -xvf ${originPackageName} + echoColor YD "unzip the base installation package" + echoColor BD "tar -xf ${originPackageName}" && tar -xf ${originPackageName} cd ${installPath} - echo "tar -xvf ${packgeName}" && tar -xvf ${packgeName} - + echoColor YD "unzip the new installation package" + echoColor BD "tar -xf ${packgeName}" && tar -xf ${packgeName} if [ ${testFile} != "tools" ] ;then - cd ${installPath}/${tdPath} && tar vxf ${subFile} - cd ${oriInstallPath}/${originTdpPath} && tar vxf ${subFile} + cd ${installPath}/${tdPath} && tar xf ${subFile} + cd ${oriInstallPath}/${originTdpPath} && tar xf ${subFile} fi - echo "check installPackage File" - - cd ${oriInstallPath}/${originTdpPath} && tree > ${installPath}/base_${originversion}_checkfile cd ${installPath}/${tdPath} && tree > ${installPath}/now_${version}_checkfile @@ -157,32 +206,30 @@ elif [[ ${packgeName} =~ "tar" ]];then diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log diffNumbers=`cat ${installPath}/diffFile.log |wc -l ` if [ ${diffNumbers} != 0 ];then - echo "The number and names of files have changed from the previous installation package" - echo `cat ${installPath}/diffFile.log` + echoColor R "The number and names of files have changed from the previous installation package" + echoColor Y `cat ${installPath}/diffFile.log` exit -1 + else + echoColor G "The number and names of files are the same as previous installation packages" fi - - cd ${installPath}/${tdPath} - if [ ${testFile} = "server" ];then - bash ${installCmd} -e no - else - bash ${installCmd} - fi - if [[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]] ;then - cd ${installPath} - sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.tar.gz . - # wget https://www.taosdata.com/assets-download/3.0/taosTools-2.1.2-Linux-x64.tar.gz - tar xvf taosTools-2.1.2-Linux-x64.tar.gz - cd taosTools-2.1.2 && bash install-taostools.sh - elif [[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "deb" ]] ;then - cd ${installPath} - sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.deb . - dpkg -i taosTools-2.1.2-Linux-x64.deb - elif [[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "rpm" ]] ;then - cd ${installPath} - sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.rpm . - rpm -ivh taosTools-2.1.2-Linux-x64.rpm --quiet - fi - fi +echoColor G "===== install taos-tools when package is lite or client =====" + + +if ([[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "tar" ]]) || [[ ${packgeName} =~ "client" ]] ;then + cd ${installPath} + sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.tar.gz . + # wget https://www.taosdata.com/assets-download/3.0/taosTools-2.1.2-Linux-x64.tar.gz + tar xf taosTools-2.1.2-Linux-x64.tar.gz + cd taosTools-2.1.2 && bash install-taostools.sh +elif [[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "deb" ]] ;then + cd ${installPath} + sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.deb . + dpkg -i taosTools-2.1.2-Linux-x64.deb +elif [[ ${packgeName} =~ "Lite" ]] && [[ ${packgeName} =~ "rpm" ]] ;then + cd ${installPath} + sshpass -p ${password} scp 192.168.1.131:/nas/TDengine3/v${version}/community/taosTools-2.1.2-Linux-x64.rpm . + rpm -ivh taosTools-2.1.2-Linux-x64.rpm --quiet +fi +