Skip to content

Commit

Permalink
Merge pull request #335 from JimmyShi22/master
Browse files Browse the repository at this point in the history
Optimize download scripts
  • Loading branch information
JimmyShi22 authored Aug 18, 2020
2 parents a0e24c6 + f1a765f commit 6f87806
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
4 changes: 2 additions & 2 deletions scripts/download_console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions scripts/download_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down
23 changes: 2 additions & 21 deletions scripts/download_wecross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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}"
Expand All @@ -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
Expand Down

0 comments on commit 6f87806

Please sign in to comment.