Skip to content

Commit

Permalink
CR-1128494: Update postinst script of xrt package to use correct dkms…
Browse files Browse the repository at this point in the history
… remove command for CentOS/RHEL (#6604) (#6611)

* Update postinst script of xrt package to use correct dkms remove command for CentOS/RHEL

* Add comment

* Address comments

> dkms o/p differs with different versions, so added checks based on dkms major versions
(cherry picked from commit d68f7b4)
  • Loading branch information
rbramand-xilinx committed Apr 14, 2022
1 parent 4046e15 commit f5505e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/CMake/config/postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ fi
echo "Unloading old XRT Linux kernel modules"
rmmod xocl
rmmod xclmgmt
XRT_VERSION_STRING_OLD=`dkms status -m xrt | awk -F, '{print $2}'`

# Dkms status o/p differs with different versions
# So we need different way of parsing old xrt version string.
dkms_major=`dkms --version | tr -d " "[a-z-:] | awk -F. '{print $1}'`
if [ $dkms_major -ge 3 ]; then
XRT_VERSION_STRING_OLD=`dkms status -m xrt | awk -F, '{print $1}' | awk -F/ '{print $2}'`
else
XRT_VERSION_STRING_OLD=`dkms status -m xrt | awk -F, '{print $2}'`
fi

for OLD in $XRT_VERSION_STRING_OLD; do
echo "Unregistering old XRT Linux kernel module sources $OLD from dkms"
dkms remove -m xrt -v $OLD --all
Expand Down

0 comments on commit f5505e4

Please sign in to comment.