#!/bin/sh
#
# Linux DGDM Pre UnInstall script.
# Should be run before a "make uninstall".
#
# 1) Will be called automagically by rpm -e.
# 2) Needs to be called manually for the tar.gz install
#    by doing a "make preuninstall"

echo "Running Pre UnInstall script..."


# Remove any symlinks the postinstall script might have made.
if [ -L /usr/bin/dpa ]
then
	if [ "`ls -l /usr/bin/dpa | grep -c dgdm`" -gt "0" ]
	then
		rm -f /usr/bin/dpa
	fi
fi

if [ -L /usr/bin/ditty ]
then
	if [ "`ls -l /usr/bin/ditty | grep -c dgdm`" -gt "0" ]
	then
		rm -f /usr/bin/ditty
	fi
fi

if [ -L /usr/bin/dinc ]
then
	if [ "`ls -l /usr/bin/dinc | grep -c dgdm`" -gt "0" ]
	then
		rm -f /usr/bin/dinc
	fi
fi
  
# Finally, Unload dgdm module if we can
if [ "`/sbin/lsmod | grep -c dgdm`" -gt "0" ]
then
	/sbin/rmmod dgdm
fi
