#!/bin/sh
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

STTA_TOOLSDIR="STTATOOLSDIR"
[ -x $STTA_TOOLSDIR/setenv_vars ] &&  . $STTA_TOOLSDIR/setenv_vars
[ ! -x "$tclShell" ] && echo "tclShell environment not set " && exit 2

dirTools=$STTA_TOOLSDIR/tcls
workDir=`pwd`;
dataStore="tta.DataStore"

case "$#" in
 0|1) echo "$msg_ensloadUSAGE" ; exit ;;
esac

[ $1 ] && dataStore=$1;
[ $2 ] && workDir=$2;

if [ ! -d $workDir ] 
then 
     mkdir $workDir
fi

if [ -r $dataStore ] 
then 
     cd $workDir
     $tclShell $dirTools/$TTArestoreCMD $dataStore
     [ "$?" -eq 0 ] &&  {
            cat tta.orgUnits | $TTA_OBJSCRIPT_CMD
            cat tta.containers | /$TTA_OBJSCRIPT_CMD
            cat tta.persons | /$TTA_OBJSCRIPT_CMD
            cat tta.server | /$TTA_OBJSCRIPT_CMD
            cat tta.applications | /$TTA_OBJSCRIPT_CMD
            cat tta.group | /$TTA_OBJSCRIPT_CMD
            cat tta.link | /$TTA_OBJSCRIPT_CMD
     }
else
     echo "$msg_nofile $dataStore"
fi
