#!/bin/sh

set -e

if [ "$1" != "remove" ] || [ "$1" != "disappear" ]
then
    update-alternatives --remove libpsm_infinipath.so.@PSM_LIB_MAJOR@ \
        /usr/lib/libpsm2-2/libpsm_infinipath.so.@PSM_LIB_VERSION@
fi

# trigger hfi1 devices to remove /dev/ipath symlink
if [ -L /dev/ipath ] ; then
	for DEV in /dev/hfi1_[0-9]; do
		if [ -c $DEV ] ; then
			udevadm trigger $DEV || true
		fi
	done
fi

#DEBHELPER#

exit 0
