#!/bin/bash
usage()
{
	cat <<EOF
Usage: $0 [options]

Options:
    -s       Show package name and version number.
    -n       Show numerical version number only.
    -l       List installed packages details (Default option).
EOF
}
if [ "X$1" == "X-s" ]; then echo OFED-internal-24.10-0.6.8:; exit 0; fi
if [ "X$1" == "X-n" ]; then echo 24.10-0.6.8; exit 0; fi
if [ "X$1" != "X-l" ] && [ "X$1" != "X" ]; then usage; exit 1; fi

cat << EOF
OFED-internal-24.10-0.6.8:

clusterkit:
mlnx_ofed_clusterkit/clusterkit-1.14.462-1.src.rpm

dpcp:
/sw/release/sw_acceleration/dpcp/dpcp-1.1.50-1.src.rpm

fwctl:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
hcoll:
mlnx_ofed_hcol/hcoll-4.8.3230-1.src.rpm

ibarr:
https://github.com/Mellanox/ip2gid master
commit 44ac1948d0d604c723bc36ade0af02c54e7fc7d2
ibdump:
https://github.com/Mellanox/ibdump master
commit 2b5da6ed350e1ed073f5ce205840c548ce0411ea
ibsim:
mlnx_ofed_ibsim/ibsim-0.12.tar.gz

ibutils2:
ibutils2/ibutils2-2.1.1-0.21902.MLNX20241029.g46cf6278.tar.gz

iser:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
isert:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
kernel-mft:
mlnx_ofed_mft/kernel-mft-4.30.0-139.src.rpm

knem:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/knem.git mellanox-master
commit 0984cf2a2de70db5c6e6fff375b070eece37c39e
libvma:
vma/source_rpms//libvma-9.8.60-1.src.rpm

libxlio:
/sw/release/sw_acceleration/xlio/libxlio-3.40.2-1.src.rpm

mlnx-dpdk:
https://github.com/Mellanox/dpdk.org mlnx_dpdk_22.11_last_stable
commit d374ef834c62b049fa036da92e201c98274f3e7b
mlnx-en:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3

mlnx-ethtool:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/ethtool.git mlnx_ofed_24_07
commit 557f0ec6d8c6dc9feea69e22e078029e53eb00fd
mlnx-iproute2:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/iproute2.git mlnx_ofed_24_10
commit 90c546ad9031dd1f79627b0a29fa5327e9dc6217
mlnx-nfsrdma:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
mlnx-nvme:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
mlnx-ofa_kernel:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3

mlnx-tools:
https://github.com/Mellanox/mlnx-tools mlnx_ofed
commit 43ec8cccc063933963c6238fc649d7dd75914444
mlx-steering-dump:
https://github.com/Mellanox/mlx_steering_dump mlnx_ofed_23_04
commit fc616d9a8f62113b0da6fc5a8948b11177d8461e
mpitests:
mlnx_ofed_mpitest/mpitests-3.2.24-2ffc2d6.src.rpm

multiperf:
https://git-nbu.nvidia.com/r/a/Performance/multiperf rdma-core-support
commit d3fad92dc6984e43cc5377ba0a3126808432ce2d
ofed-docs:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/ofed-docs.git mlnx_ofed-4.0
commit 3d1b0afb7bc190ae5f362223043f76b2b45971cc

openmpi:
mlnx_ofed_ompi_1.8/openmpi-4.1.7rc1-1.src.rpm

opensm:
mlnx_ofed_opensm/opensm-5.21.0.MLNX20241029.d9aa3dff.tar.gz

openvswitch:
https://gitlab-master.nvidia.com/sdn/ovs doca_2_6
commit 1a6f66e13713ff5c6861a540c6e014f8cd76c139
perftest:
mlnx_ofed_perftest/perftest-24.10.0-0.65.g9093bae.tar.gz

rdma-core:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/rdma-core.git mlnx_ofed_24_10
commit f82fb02bb18d34d9695d8dfc798bd522be76666b
rshim:
/sw_mc_soc_release/packages//rshim-2.1.5-0.g8dfd6ea.src.rpm

sharp:
mlnx_ofed_sharp/sharp-3.9.0.MLNX20241029.7a20b607.tar.gz

sockperf:
sockperf/sockperf-3.10-0.git5ebd327da983.src.rpm

srp:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_24_10
commit 9b1cc6cb7976b2d233e9ed9f7ae6c6583a6f77f3
ucx:
mlnx_ofed_ucx/ucx-1.18.0-1.src.rpm

xpmem-lib:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/xpmem-lib-2.7-0.2310055.src.rpm

xpmem:
https://git-nbu.nvidia.com/r/a/mlnx_ofed/xpmem.git mellanox-master
commit 4f986529f199efa0675a2d86832a0aa46749f6b8
EOF

echo
echo Installed Packages:
echo -------------------

pkglist1=
pkglist2=

if [ -x /usr/bin/dpkg ]; then
    pkglist1=$(dpkg --list | grep -E "clusterkit|dpcp|fwctl-dkms|hcoll|ibarr|ibdump|ibsim|ibsim-doc|ibutils2|iser-dkms|isert-dkms|kernel-mft-dkms|knem|knem-dkms|libvma|libvma-dev|libvma-dbg|libvma-utils|libxlio|libxlio-dev|libxlio-dbg|libxlio-utils|mlnx-dpdk|mlnx-dpdk-doc|mlnx-dpdk-dev|mlnx-en-utils|mlnx-en-dkms|mlnx-ethtool|mlnx-iproute2|mlnx-nfsrdma-dkms|mlnx-nvme-dkms|mlnx-ofed-kernel-utils|mlnx-ofed-kernel-dkms|mlnx-tools|mlx-steering-dump|mpitests|openmpi|opensm|opensm-doc|libopensm|libopensm-devel|openvswitch-datapath-source|openvswitch-datapath-dkms|openvswitch-common|libopenvswitch|openvswitch-switch|openvswitch-pki|openvswitch-testcontroller|openvswitch-dbg|python3-openvswitch|openvswitch-test|openvswitch-vtep|libopenvswitch-dev|openvswitch-ipsec|perftest|rdma-core|ibacm|ibverbs-providers|ibverbs-utils|libibverbs-dev|libibverbs1|libibverbs1-dbg|libibumad-dev|libibumad3|libibumad3-dbg|librdmacm-dev|librdmacm1|librdmacm1-dbg|rdmacm-utils|srptools|python3-pyverbs|infiniband-diags|libibmad5|libibmad5-dbg|libibmad-dev|libibnetdisc5|libibnetdisc5-dbg|libibnetdisc-dev|rshim|sharp|sockperf|srp-dkms|ucx-dev|ucx|ucx-xpmem|ucx-cuda|ucx-gdrcopy|libxpmem-dev|libxpmem0|xpmem|xpmem-dkms|xpmem-modules")
fi

if (which rpm >/dev/null 2>&1); then
    pkglist2=$(rpm -qa --queryformat "[%{NAME}]
" | grep -E "kernel-ib|clusterkit|dpcp|^fwctl$|kmod-fwctl|fwctl.*kmp|hcoll|ibarr|ibdump|ibsim|ibutils2|^iser|kmod-iser|iser.*kmp|^isert|kmod-isert|isert.*kmp|kernel-mft|knem|libvma|libxlio|mlnx-dpdk|mlnx-en|mlnx-ethtool|mlnx-iproute2|mlnx-nfsrdma|mlnx-nvme|mlnx-ofa_kernel|mlnx-tools|mlx-steering-dump|mpitests|multiperf|ofed-docs|openmpi|opensm|openvswitch|perftest|rdma-core|ibacm|libibcm|libibumad|libibverbs|librdmacm|srp_daemon|infiniband-diags|python3-pyverbs|rshim|sharp|sockperf|^srp$|kmod-srp|srp.*kmp|ucx|xpmem-lib|xpmem|neohost-backend|neohost-sdk")
fi

echo -e "$pkglist1"
echo -e "$pkglist2"
