#!/bin/sh
# 
# AxeneInstall for Axene Office in 
# Launch the installation soft or script.
# 
# Copyright (C) 1994-1997. All Rights reserved.
# Xcalibur Team (S.Boisson, A.Buat, R.Castanier, E.Paris)
# Email: <xcalibur@axene.com>
# 
# Started on  Wed Jan 21 03:20:53 1998 Xibios 2
# Last update Tue Mar 10 04:31:50 1998 Xibios 2
#

#--- Init global variables
ECHONL1="echo "
ECHONL2=

test_echo=`echo -n test`
if [ $test_echo = "-n test" ]; then
 test_echo=`echo "test\c"`
 if [ $test_echo = "test\c" ]; then
  test_echo=`echo -e "test\c"`
  if [ $test_echo = "test" ]; then
   ECHONL1="echo -e "
   ECHONL2="\c"
  fi
 else
  ECHONL1="echo "
  ECHONL2="\c"
 fi
else
  ECHONL1="echo -n "
fi

SkipLine() { echo " "; }
Fatal() { echo "${progname}: error: ${1}" 1>&2 ; exit 1; }

progname=`basename $0`
top=`dirname $0`

if [ $# -ge 1 ]; then
 if [ "$1" = "-i" ]; then
  while :; do    
   $ECHONL1"Run X11 Install program or Text Install program [X/t] ? "$ECHONL2
   read reply
   if [ ${#reply} = 0 ]; then
    reply="X"
    break;
   elif [ "$reply" = "X" -o "$reply" = "x" -o "$reply" = "t" ]; then 
    break;
   fi
  done

  if [ "$reply" = "t" ]; then
   if [ -f $top/[Pp]ackages/install.sh ]; then
    cd $top/[Pp]ackages
    exec ./install.sh
   else
    Fatal "The Text Install Program is missing. Sorry !"
   fi
  else
   if [ -f $top/[Pp]ackages/[Xx][Ii]nstall* ]; then
    exec $top/[Pp]ackages/[Xx][Ii]nstall* $@
   else
    Fatal "The X11 Install Program is missing. Sorry !"
   fi
  fi
 fi
fi

if [ -f $top/[Pp]ackages/[Xx][Ii]nstall* ]; then
 exec $top/[Pp]ackages/[Xx][Ii]nstall* $@
elif [ -f $top/[Pp]ackages/install.sh ]; then
 cd $top/[Pp]ackages
 exec ./install.sh
else
 Fatal "No Install Program Found !"
fi





