Skip to content

Instantly share code, notes, and snippets.

@joelrebel
Last active November 29, 2024 17:16
Show Gist options
  • Save joelrebel/fbea27e673ff6ba306f088e475cdbdd5 to your computer and use it in GitHub Desktop.
Save joelrebel/fbea27e673ff6ba306f088e475cdbdd5 to your computer and use it in GitHub Desktop.
Mellanox firmware down helper
#!/bin/bash
set -e
echo "Make a choice from the options below (enter the number)"
PRODUCTS=("connectx4lxen" "connectx5en" "connectx6lx")
for idx in ${!PRODUCTS[@]}; do
echo "${idx}. ${PRODUCTS[${idx}]}"
done
read PICKED_PRODUCT
if [ ! "${PRODUCTS[${PICKED_PRODUCT}]+baz}" ];
then
echo "incorrect choice"
exit 1
fi
NIC_VERSION="${PRODUCTS[${PICKED_PRODUCT}]}"
API="https://downloaders.azurewebsites.net/downloaders/${NIC_VERSION}_downloader/helper.php"
# 1. get available firmware versions
echo ">> available firmware versions.."
curl -sL -X POST -d "action=get_versions" $API | jq .
echo "Pick the version to be downloaded.."
read VERSION
# 2. get available firmware distributions for a version
echo ">> available firmware distributions by OPN (ordering part number)"
curl -sL -X POST -d "action=get_distros&version=${VERSION}" $API | jq .
echo "Pick the firmware OPN identifier.."
read DIST
## 3. get available PSID (MT_000..)
#
# PSID (Parameter-Set IDentification) is a 16-ascii character string embedded in the firmware image
# which provides a unique identification for the configuration of the firmware.
echo ">> available firmware BoardID/PSIDs for firmware"
curl -sL -X POST -d "action=get_oses&version=${VERSION}&distro=${DIST}" $API | jq .
echo "Pick the firmware PSID identify.."
read PSID
# 4. get available firmware for the OS x86_64 arch
echo ">> available firmware distributions for OS version and arch x86_64"
curl -sL -X POST -d "action=get_download_info&version=${VERSION}&distro=${DIST}&os=${PSID}&arch=x64" $API | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment