diff --git a/scripts/download_console.sh b/scripts/download_console.sh index ee737e6da..b92cddd52 100644 --- a/scripts/download_console.sh +++ b/scripts/download_console.sh @@ -112,7 +112,7 @@ download_release_pkg() fi # download - if [ -f "${release_pkg}" ] && [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -eq "0" ];then + if [ -f "${release_pkg}" ] && md5sum -c ${release_pkg_checksum_file}; then LOG_INFO "Latest release ${release_pkg} exists." else LOG_INFO "Try to download from: ${cdn_url}/${compatibility_version}/${release_pkg}" @@ -122,7 +122,7 @@ download_release_pkg() curl -C - -LO ${github_url}/${compatibility_version}/${release_pkg} fi - if [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -ne "0" ]; then + if ! md5sum -c ${release_pkg_checksum_file}; then LOG_ERROR "Download package error" rm -f ${release_pkg} exit 1 diff --git a/scripts/download_demo.sh b/scripts/download_demo.sh index 0d8307b3e..a15b7edfd 100644 --- a/scripts/download_demo.sh +++ b/scripts/download_demo.sh @@ -95,8 +95,8 @@ download_release_pkg() exit 1 fi - # download - if [ -f "${release_pkg}" ] && [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -eq "0" ];then + # download + if [ -f "${release_pkg}" ] && md5sum -c ${release_pkg_checksum_file}; then LOG_INFO "Latest release ${release_pkg} exists." else LOG_INFO "Try to download from: ${cdn_url}/${compatibility_version}/${release_pkg}" @@ -106,7 +106,7 @@ download_release_pkg() curl -C - -LO ${github_url}/${compatibility_version}/${release_pkg} fi - if [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -ne "0" ]; then + if ! md5sum -c ${release_pkg_checksum_file}; then LOG_ERROR "Download package error" rm -f ${release_pkg} exit 1 diff --git a/scripts/download_wecross.sh b/scripts/download_wecross.sh index 0087596a7..aa24509ea 100644 --- a/scripts/download_wecross.sh +++ b/scripts/download_wecross.sh @@ -75,25 +75,6 @@ done } -parallel_download() -{ - #parallel_download WeCross.tar.bz2.md5 https://github.com/WeBankFinTech/WeCross/releases/download/${compatibility_version} - md5_file_list=${1} - prefix=${2} - # shellcheck disable=SC2162 - - while read line;do - local part=$(echo ${line}|awk '{print $2}') - curl -s -C - -LO ${prefix}/${part} & - done < "${md5_file_list}" - wait - - if [ ! -z "$(md5sum -c ${md5_file_list}|grep FAILED)" ];then - LOG_ERROR "Download WeCross package failed! URL: ${prefix}" - exit 1 - fi -} - download_wecross_pkg() { local github_url=https://github.com/WeBankFinTech/WeCross/releases/download/ @@ -142,7 +123,7 @@ download_release_pkg() fi # download - if [ -f "${release_pkg}" ] && [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -eq "0" ];then + if [ -f "${release_pkg}" ] && md5sum -c ${release_pkg_checksum_file}; then LOG_INFO "Latest release ${release_pkg} exists." else LOG_INFO "Try to download from: ${cdn_url}/${compatibility_version}/${release_pkg}" @@ -152,7 +133,7 @@ download_release_pkg() curl -C - -LO ${github_url}/${compatibility_version}/${release_pkg} fi - if [ "$(md5sum -c ${release_pkg_checksum_file}|echo $?)" -ne "0" ]; then + if ! md5sum -c ${release_pkg_checksum_file}; then LOG_ERROR "Download package error" rm -f ${release_pkg} exit 1