#!/bin/sh

LIST_STTACMDS="ldapreplicate scanttacache monitor ttasess stta ensrecreate ensrestore ensload ttatcl setenv_vars openldap oldapadm"
LIST_TTACMDS="tta ttabackup"
LIST_TCLS="ensdump ensrestore"
LIST_lib="ldap-lib.pl lists-lib.pl base-lib.pl ttacache-lib.pl global-lib.pl "
LIST_tcls="ttaDumpDs.tcl ttaRestoreDs.tcl"
LIST_DIRS="tcls lib"
LIST_LNKCMDS="tta stta"
brandInfoFile=.brandinfofile
SttaBrandInfoFile=.brandinfofile.stta
STTA_SHELLS=shells
TOOLSDIR=tools

keep_ext=".cgi .pl .sh .js .txt .tcl"
keep_prefix="config default module"
to_copyhere="/etc/webmin/stta/admin.acl /etc/webmin/stta/dataconf"

name="Tarantella"
desc_es="Servicios con Tarantella"
desc_en="Services with Tarantella"
depends="1.0"
version="1.3"

# Others 
dn=/dev/null
PAGER=more

# Webmin locations 
WEBMIN=`cat /etc/webmin/miniserv.conf 2>/dev/null | egrep "^root=" | sed 's/root=//g'`

origen=`pwd` 
cd $WEBMIN 2>$dn
WEBMINDIR=`pwd`
cd $origen 
[ ! "$WEBMINDIR" ] && echo "NO WEBMIN DIR " && exit 1
MODULE=stta

# To pack & Save
SAVEFILE=stta-1.3.wbm

# TTA 
TTAHOME=/opt/tarantella
STTATOOLS=$TTAHOME/tools

# tools STTA
SETUPDIR=$WEBMINDIR/$MODULE/tools
MKTOOLS=$WEBMINDIR/$MODULE/mktools.sh

# To run STTA
TOOLSDIR=tools

# For TCLS
tclShell=/opt/tarantella/tools/tcls/ttatcl.sh
dirTools=/opt/tarantella/tools/tcls
dumpCMD=ttaDumpDs.tcl
restoreCMD=ttaRestoreDS.tcl


# Just to start
origen=`pwd` 
ahora=`date +%Y_%m_%d_%H%M%S`

case "$trace" in
x) set -x
esac

show_file () {
   [ "$1" ] && { 
          [ -r "$1.$LANG" ] && $PAGER "$1.$LANG" && return
          [ -r "$1" ] && $PAGER "$1" && return
   }
}
show_help () {
   [ "$1" ] && { 
          fname=`basename $0 2>$dn` 
          show_file $1/$fname
   }
}

make_dir () {
   mkdir $DESTDIR 2>$dn
   [ ! -d $DESTDIR ] && exit 2
   chown root:bin $DESTDIR
   chmod 755 $DESTDIR
}
