#!/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-23.10-1.1.9:; exit 0; fi
if [ "X$1" == "X-n" ]; then echo 23.10-1.1.9; exit 0; fi
if [ "X$1" != "X-l" ] && [ "X$1" != "X" ]; then usage; exit 1; fi

cat << EOF
OFED-internal-23.10-1.1.9:

clusterkit:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/clusterkit-1.11.442-1.2310055.src.rpm

dpcp:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/dpcp-1.1.43-1.2310055.src.rpm

hcoll:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/hcoll-4.8.3223-1.2310055.src.rpm

ibarr:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/ibarr-0.1.3-1.2310055.src.rpm

ibdump:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/ibdump-6.0.0-1.2310055.src.rpm

ibsim:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/ibsim-0.12-1.2310055.src.rpm

ibutils2:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/ibutils2-2.1.1-0.1.MLNX20231105.g79770a56.2310055.src.rpm

iser:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

isert:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

kernel-mft:
mlnx_ofed_mft/kernel-mft-4.26.1-3.src.rpm

knem:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/knem-1.1.4.90mlnx3-OFED.23.10.0.2.1.1.src.rpm

libvma:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/libvma-9.8.40-1.src.rpm

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

mlnx-dpdk:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mlnx-dpdk-22.11.0-2310.1.0.2310055.src.rpm

mlnx-en:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

mlnx-ethtool:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mlnx-ethtool-6.4-1.2310055.src.rpm

mlnx-iproute2:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mlnx-iproute2-6.4.0-1.2310055.src.rpm

mlnx-nfsrdma:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

mlnx-nvme:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

mlnx-ofa_kernel:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

mlnx-tools:
https://github.com/Mellanox/mlnx-tools mlnx_ofed
commit d3edfb102ad4c3103796192b3719a5f9cd24c7f9
mlx-steering-dump:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mlx-steering-dump-1.0.0-0.2310055.src.rpm

mpitests:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mpitests-3.2.21-8418f75.2310055.src.rpm

mstflint:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/mstflint-4.16.1-2.2310055.src.rpm

multiperf:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/multiperf-3.0-3.0.2310055.src.rpm

ofed-docs:
docs.git mlnx_ofed-4.0
commit 3d1b0afb7bc190ae5f362223043f76b2b45971cc

openmpi:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/openmpi-4.1.7a1-1.2310055.src.rpm

opensm:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/opensm-5.17.0.MLNX20231105.d437ae0a-0.1.2310055.src.rpm

openvswitch:
https://gitlab-master.nvidia.com/sdn/ovs mlnx_ofed_23_10
commit c5eb44be9b4d8ee0f6b367b439c582f3487cc741

perftest:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/perftest-23.10.0-0.29.g0705c22.2310055.src.rpm

rdma-core:
mlnx_ofed/rdma-core.git mlnx_ofed_23_10
commit 6c404a661569eb130be94df67f8a98e6794c0c35
rshim:
mlnx_ofed_soc/rshim-2.0.17-0.g0caa378.src.rpm

sharp:
mlnx_ofed_sharp/sharp-3.5.1.MLNX20231116.7fcef5af.tar.gz

sockperf:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/sockperf-3.10-0.git5ebd327da983.2310055.src.rpm

srp:
mlnx_ofed/mlnx-ofa_kernel-4.0.git mlnx_ofed_23_10
commit a675be032c722b022cd9166921fbc6195e7fe8ff

ucx:
mlnx_ofed_ucx/ucx-1.16.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:
/sw/release/mlnx_ofed/IBHPC/OFED-internal-23.10-0.5.5/SRPMS/xpmem-2.7.3-1.2310055.src.rpm

EOF

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

pkglist1=
pkglist2=

if [ -x /usr/bin/dpkg ]; then
    pkglist1=$(dpkg --list | grep -E "#DEB_PACKAGES_LIST#")
fi

if (which rpm >/dev/null 2>&1); then
    pkglist2=$(rpm -qa --queryformat "[%{NAME}]
" | grep -E "kernel-ib|clusterkit|dpcp|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|mstflint|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"
