#!/bin/sh

PID=$$
TMP_FILE=/tmp/ntap_san_inst_$PID
INS_DIR=/opt/netapp
INS_BIN_DIR=/opt/netapp/santools

# Ensure the user is running as root
USER=`/usr/bin/whoami`

if [ "$USER" != "root" ]
then
        echo
        echo This uninstall program must be run as root.
        echo
        exit 1
fi

rm -f /usr/sbin/sanlun

OS_RELEASE=`lsb_release -r -s`;

rpm -qf /sbin/mpath_prio_ontap > /dev/null 2>&1;
BUNDLED=$?;

#Remove mpath_prio_ontap only if it has been previously installed by the HU kit
if [ "$BUNDLED" -ne "0" ]; then
      if [ "$OS_RELEASE" = "5.1" ]; then
            #For RHEL 5.1, alone, remove both the static mpath_prio_ontap and its softlink
            rm -f /sbin/mpath_prio_ontap.static
            rm -f /sbin/mpath_prio_ontap
      else
            #For other OSs, remove the mpath_prio_ontap file
            rm -f /sbin/mpath_prio_ontap
      fi
fi

# See if there is a sanlun installed 
if [ -d $INS_DIR ] ; then
	# There is an /opt/netapp dir present remove it
	/bin/rm -rf $INS_DIR 
else
	echo "sanlun not installed.  $INS_DIR does not exist"	
fi;

exit 0;
