#!/bin/sh
#
# Sample postscript that can be executed to check the Mellanox OFED version
# and adapter firmware level on the Mellanox adapters installed on the target nodes
#
#
BINARIES="ofed_info mst ibdev2netdev"
for PROG in ${BINARIES}; do
    RC=`command -v ${PROG} >> /dev/null 2>&1; echo $?`
    if [[ ${RC} != 0 ]]; then
        echo "${PROG} is not installed on this node, unable to check firmware levels."
        exit 1
    fi
done

MELLANOX_SOFTWARE=`ofed_info -s | cut -d: -f1`
echo "Mellanox Software: $MELLANOX_SOFTWARE"


mst start >> /dev/null
if [[ $? != 0 ]]; then
   echo "Error:  Could not start mst, cannot check adapter firmware level."
   exit 1
fi

ibdev2netdev -v

exit 0
