drivers,mlnx: add sha256 check for MLNX tgz
To ensure the down load file is correct, add sha256 check for MLNX tgz. Signed-off-by: Jianping Liu <frankjpliu@tencent.com> Reviewed-by: Yongliang Gao <leonylgao@tencent.com>
This commit is contained in:
parent
3353ce662c
commit
c92c287ac7
|
@ -12,12 +12,16 @@ check_url_reachable()
|
|||
thirdparty_mlnx(){
|
||||
mlnx_tgz_url=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_url)
|
||||
mlnx_tgz_name=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_tgz_name)
|
||||
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
|
||||
mv ${mlnx_tgz_name} ${mlnx_tgz_name}_ori
|
||||
timeout 900 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0
|
||||
|
||||
sha256_tmp=$(sha256sum ${mlnx_tgz_name} | awk '{printf $1}')
|
||||
if [[ $sha256_tmp != $mlnx_tgz_sha256 ]]; then get_mlnx_tgz_ok=0; fi
|
||||
|
||||
if (( $get_mlnx_tgz_ok == 0 )); then
|
||||
mv -f ${mlnx_tgz_name}_ori ${mlnx_tgz_name}
|
||||
echo "Download MLNX_OFED_LINUX-*.tgz fail!"
|
||||
|
|
|
@ -3,18 +3,22 @@
|
|||
mlnx_version="23.10-3.2.2.0"
|
||||
|
||||
mlnx_tgz_name="MLNX_OFED_LINUX-$mlnx_version-rhel9.4-x86_64.tgz"
|
||||
mlnx_tgz_sha256="800b8d0f063558bf943d5b3fabf02cbbfa84a57b2690c2128a10fdaf7636d2dc"
|
||||
|
||||
if [[ $1 == mlnx_url ]]; then
|
||||
mlnx_url="https://content.mellanox.com/ofed/MLNX_OFED-$mlnx_version/$mlnx_tgz_name"
|
||||
echo "$mlnx_url"
|
||||
exit 0
|
||||
elif [[ $1 == mlnx_version ]]; then
|
||||
echo $mlnx_version
|
||||
exit 0
|
||||
elif [[ $1 == mlnx_tgz_name ]]; then
|
||||
echo $mlnx_tgz_name
|
||||
exit 0
|
||||
elif [[ $1 == mlnx_tgz_sha256 ]]; then
|
||||
echo $mlnx_tgz_sha256
|
||||
exit 0
|
||||
else
|
||||
echo "Error: wrong parameter for release-drivers/mlnx/get_mlnx_tgz_url.sh!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$mlnx_url"
|
||||
|
|
Loading…
Reference in New Issue