dist: exit 1 if download mlnx commercial drivers fail

If download mlnx commercial drivers fail, exit 1 to let users known
about it.

Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
Reviewed-by: Yongliang Gao <leonylgao@tencent.com>
This commit is contained in:
Jianping Liu 2024-08-27 19:32:42 +08:00
parent 4eb6f1908f
commit 8b5cff9dfa
1 changed files with 9 additions and 3 deletions

View File

@ -2,7 +2,11 @@
check_url_reachable()
{
curl -I https://gitee.com 1>/dev/null 2>&1 || exit 0
curl -I https://content.mellanox.com 1>/dev/null 2>&1
if (( $? != 0 )); then
echo "Could not reache https://content.mellanox.com"
exit 1
fi
}
thirdparty_mlnx(){
@ -12,10 +16,12 @@ thirdparty_mlnx(){
if [ $(stat -c%s ${mlnx_tgz_name}) -gt 1024 ]; then return 0; fi
mv ${mlnx_tgz_name} ${mlnx_tgz_name}_ori
timeout 600 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0
timeout 900 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0
if (( $get_mlnx_tgz_ok == 0 )); then
mv -f ${mlnx_tgz_name}_ori ${mlnx_tgz_name} ; exit 0
mv -f ${mlnx_tgz_name}_ori ${mlnx_tgz_name}
echo "Download MLNX_OFED_LINUX-*.tgz fail!"
exit 1
else
rm -f ${mlnx_tgz_name}_ori
fi