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

TTAHOME="/opt/tarantella"
dataDir=`pwd`;
ensBak="ens.cpio.gz"

[ $1 ] && dataDir=$1;

if [ -s $dataDir/$ensBak ] 
then 
     cp $dataDir/$ensBak $TTAHOME/var
     cd $TTAHOME/var
     gunzip $ensBak
     if [ "$?" -eq 0 ] ; then 
          ensfile=`echo $ensBak| sed 's/.gz//'`
          tta stop --force
          rm -r ens.old 2>/dev/null
          echo "ens renamed to ens.old ..."
          mv ens ens.old 
          cpio -idumvI $ensfile
          [ "$?" -ne 0 ] && rm -r ens &&  mv ens.old ens  && echo "error: ens recovered"
          rm $ensfile 2>/dev/null
     fi
     tta start
else
     echo "No file: $ensBak in $dataDir "
fi
