#!/bin/sh
# Copyright (C) 2003 SpeedSix Software Ltd.
#
# INSTALL_SSLS - Friendly interface to SpeedSix License Server Installation.
# ==========================================================================
#
# 30-JUN-2003  V0.3  Linux Burn beta (281)
# 27-FEB-2004  V0.4  Linux Burn (282)
# 09-JUN-2005  V0.5  No longer conditionally install e2fsprogs-1.27-9

#
# start
#

echo
echo "Installing SpeedSix License Server V1.2 (Rel. 706) for Red Hat Linux V8.0 etc."
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_ssls"
        exit 1
fi

#
# Check that e2fsprogs is installed. If not, install it.
# This is needed by various S6 things because it supplies libuuid (UUID generation).
# Sadly, this isn't installed by default.
#

#E2FSPROGS=`rpm -q e2fsprogs`
#if [ "$E2FSPROGS" != "e2fsprogs-1.27-9" ]; then
#rpm -Uvh ./e2fsprogs-1.27-9.i386.rpm
#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

#
# Install our stuff
#

if [ -f /etc/init.d/sslserver ]; then
echo "Stopping sslserver."
/etc/init.d/sslserver stop
echo "Un-installing sslserver."
rpm -ev sslserver
fi

./instaid
rpm -Uvh --replacefiles ./sslserver-1.2-706.i386.rpm
/sbin/chkconfig --add sslserver

if [ -f /etc/init.d/sslserver ]; then
echo "Starting sslserver."
/etc/init.d/sslserver start
fi

#
# finished
#

echo
echo "Installation completed."
echo
exit 0
