#!/bin/sh
# Copyright (C) 2003-2009 SpeedSix Software Ltd.
#
# Uninstall SpeedSix Trailz Raptor for Autodesk M&E Systems (32 bit) on Linux.
#

echo
echo "Un-installing SpeedSix Trailz Raptor for Autodesk M&E Systems (32 bit) on Linux."
echo "=============================================================================="
echo

unalias cp >& /dev/null
unalias rm >& /dev/null
unalias mv >& /dev/null

if [ "`whoami`" != "root" ]; then
        echo "You need to be root to run this script. You can become root"
        echo "by using the command su. Please do this, then restart the"
        echo "un-installation with ./uninstall-discreet-linux-trailz-raptor"
        exit 1
fi

echo
echo -n "Are you sure you want to un-install? [y or n] > "
read inp
case $inp in
    y*) break;;
    *) echo "OK ... leaving everything installed ... "; exit 1;;
esac
echo

#
# First remove the specific Proxy Images:
#
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailAll.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailAverage.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailDecay.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailLive.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailOver.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailParticle.spark.p
rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/6-TrailStopMo.spark.p

#
# Try to stop flowfinder service
#

if [ -e /etc/init.d/flowfinder ]; then
    /etc/init.d/flowfinder stop
    /sbin/chkconfig --del flowfinder
fi

#
# Now remove the package.
#
rpm -ev discreet-linux-trailz-raptor

echo
echo "Un-install completed."
echo
exit 0
