#!/bin/sh
# Shell to install STTA path 

cgilist="tta_sessbilling.cgi tta_sesstotal.cgi"
libs="ttasess-lib.pl lists-lib.pl"

dn=/dev/null
  case `basename $STTA` in 
     tarantella) # Version 1.2 
                  for file in `ls ./config/* 2>$dn`
                  do 
                       nom=`basename $file`
                       cat $file >> /etc/webmin/tarantella/config 
                  done
                  ;;
     stta) # Version 1.3 
                  for file in `ls ./config/* 2>$dn`
                  do 
                       nom=`basename $file`
                       cat $file >> /etc/webmin/stta/dataconf/$nom
                  done
                  ;;
     *)  echo "ERROR:  STTA is not SET "
         echo "Set STTA to STTA directory "
         exit 2;
                  ;;
  esac
  # Setting Lang files
  for file in `ls ./lang/* 2>$dn`
  do
      nom=`basename $file`
      cat $file >> $STTA/lang/$nom
  done

  # Setting Help files
  [ -d ./help ] && cp -pr ./help $STTA

  # Setting images files
  [ -d ./images ] && cp -pr ./images $STTA

  # INDEX 
  for file in `ls ./index/* 2>$dn`
  do 
     cp $file $STTA/index
  done
  # CGIS & LIBS  
  for file in `echo $cgilist`
  do 
     cp $file $STTA
  done
  for file in `echo $libs`
  do 
     cp $file $STTA
  done
  
  [ -r ./syscmd ] && sh syscmd 2>$dn

 echo "$STTA  Updated !!!! "
