From 198d728bcc79a32db8d99537675800d26d7027d7 Mon Sep 17 00:00:00 2001 From: Jianping Liu Date: Thu, 29 Aug 2024 10:10:26 +0800 Subject: [PATCH] dist: check sha256 if mlnx tgz is already exist In dist/sources/download-and-copy-drivers.sh, if mlnx tgz is greater than 1024 byte, that stand for really mlnx tgz is exist. Script will return 0, without check sha256. Change it to check sha256 anyway. Signed-off-by: Jianping Liu Reviewed-by: Yongliang Gao --- dist/sources/download-and-copy-drivers.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/sources/download-and-copy-drivers.sh b/dist/sources/download-and-copy-drivers.sh index badaee5ad8fd..c9a9e4651f90 100755 --- a/dist/sources/download-and-copy-drivers.sh +++ b/dist/sources/download-and-copy-drivers.sh @@ -20,10 +20,12 @@ thirdparty_mlnx(){ mlnx_tgz_sha256=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_tgz_sha256) get_mlnx_tgz_ok=1 - if [ $(stat -c%s ${mlnx_tgz_name}) -gt 1024 ]; then return 0; fi - - rm -f ${mlnx_tgz_name} - timeout 900 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0 + # Real MLNX_OFED_LINUX-*.tgz will more than 1024 bytes. + # Dummy MLNX_OFED_LINUX-*.tgz will less than 1024 bytes. + if [ $(stat -c%s ${mlnx_tgz_name}) -lt 1024 ]; then + rm -f ${mlnx_tgz_name} + timeout 900 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0 + fi sha256_tmp=$(sha256sum ${mlnx_tgz_name} | awk '{printf $1}') if [[ $sha256_tmp != $mlnx_tgz_sha256 ]]; then get_mlnx_tgz_ok=0; fi