set -euo pipefail

tmpdir=$(mktemp -d)
cd ${tmpdir}
wget https://www.mellanox.com/downloads/ofed/MLNX_OFED-4.7-1.0.0.1/MLNX_OFED_LINUX-4.7-1.0.0.1-ubuntu14.04-x86_64.tgz
tar xf MLNX_OFED_LINUX-4.7-1.0.0.1-ubuntu14.04-x86_64.tgz
cd MLNX_OFED_LINUX-4.7-1.0.0.1-ubuntu14.04-x86_64/DEBS/MLNX_LIBS
ar x libibverbs1_41mlnx1-OFED.4.7.0.0.2.47100_amd64.deb
tar xf data.tar.xz
ln -s libibverbs.so.1 usr/lib/libibverbs.so
tar zcf libibverbs.tar.gz usr
echo "tarball created at $(readlink -f libibverbs.tar.gz)"
