#!/bin/sh
#
# INSTALL_S6 - Friendly interface to Monsters Installation.
# =========================================================
#
# 24-FEB-2003  V0.0  SpeedSix Installation Procedure


#
# Ensure we are now root
#

if [ "`whoami`" != "root" ]; then
        /usr/bin/X11/xconfirm -c \
        -header "Error" \
        -icon error \
        -t "You need to be root to run this script. You can become root" \
        -t "by using the command su. Please do this, then restart the" \
        -t "installation with ./install_s6" \
        -B "OK"
        exit 1
fi

#
# make sure they have seen the eula and agreed to its terms etc
#
case `/usr/bin/X11/xconfirm -c \
        -header "End User License Agreement" \
        -file ./SPEEDSIX_END_USER_LICENSE.txt \
	-icon question \
	-useslider \
	-exclusive \
        -B "Accept" -b "Reject"`
	in
        Accept);;
        Reject) echo "exit";exit 1;;
esac
echo "License Agreement Accepted  - Installation Commences"
#
#
# Using X display OR text...
#
if [ ${DISPLAY:-""} != "" ]; then
  INSTPRGM=swmgr
  echo 'swmgr'
else
#  INSTPRGM="inst -a";
  echo 'cannot run 'swmgr' from here - exiting'
  exit 0
fi

#
# Distribution Path finding
#
distpath=$PWD
echo $distpath
#
# run the license setup routine
./instaid
./fm_instaid

# be smart & look for dist subdirectory
if [ -d dist ]; then
	distpath=$PWD
fi


        /usr/bin/X11/xconfirm -c \
        -header "swmgr Installation Instructions" \
        -icon info\
        -t "When the swmgr launches...." \
        -t "Click on 'Start'" \
        -t "or Click on 'Customise Installation' and select products to install." \
        -t "Fluidz, Lenz, Speedo and Trailz are optional." \
        -B "OK"


 ${INSTPRGM} -f $distpath

exit
