#!/bin/sh
# Copyright (C) 2003-2006 SpeedSix Software Ltd.
#
# install_s6 - SpeedSix Package Installation Script
# =================================================
#
# Install SpeedSix Lenz Raptor for Discreet Advanced Systems (32 bit) on Burn.

#
# Start
#

echo
echo "Installing SpeedSix Lenz Raptor for Discreet Advanced Systems (32 bit) on Burn."
echo "=============================================================================="
#echo "      Please consult the release notes for more information."
echo

#
# Ensure we are now root
#

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 "installation with ./install_s6"
        exit 1
fi

#
# Make sure they have seen the eula and agreed to its terms etc
#

echo
echo "Please read the SpeedSix End User License Agreement before installation."
echo
echo -n "Ready to read the agreement? [y or n] > "
read inp
case $inp in
    y*) break;;
    *) echo "OK ... exiting ... "; exit 1;;
esac
echo
more ./speedsix_eula
echo
echo "=== END OF THE LICENSE AGREEMENT ========================="
echo
echo -n "Do you agree? [y or n] > "
read inp
case $inp in
    y*) break;;
    *) echo "OK ... exiting ... "; exit 1;;
esac
echo

#
# Circumvent yet another possible fly in the ointment.
# It would be *funny* if it were not so *painful*.
# Oh yeah - and this is sh not csh, so it gets worse...
# Because if these happen NOT to be defined you get ugly messages.
# Unix never misses an opportunity to castigate you.
#

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

#
# Silently un-install our previous version
#

rpm -ev discreet-burn-lenz-raptor 2> /dev/null

#
# Install our stuff
#

rpm -Uvh --force ./discreet-burn-lenz-raptor-1.2-703.i386.rpm
cp ./uninstall-discreet-burn-lenz-raptor /usr/local/SpeedSix/bin
chmod a+x /usr/local/SpeedSix/bin/uninstall-discreet-burn-lenz-raptor

#
# If Firefox isn't there, pretend Mozilla is Firefox ...
#

if [ ! -e /usr/bin/firefox ]; then
        ln -s /usr/bin/mozilla /usr/bin/firefox
fi

#
# Check licenses & copy the appropriate proxy image...
#

rm -f /usr/discreet/sparks/SpeedSix_V1.2_Raptors/*.p
/usr/local/SpeedSix/bin/CHECK_LICENSE_LENZ 2> /dev/null
chmod a+w /usr/discreet/sparks/SpeedSix_V1.2_Raptors/*.p

#
# Finished
#

echo
echo "Installation completed."
exit 0
