#!/bin/sh
#This script is to generate a groovy description file for the filterMahager subsystem.
#The filterMahager subsystem is used to test FilterManager class.

#Directory where one can find the groovy description files
source .setupFCS_BIN
echo "RESOURCES_DIR=$RESOURCES_DIR"


#the file this script is going to generate
FILTER_MANAGER_FILENAME=filterManager__simulation.groovy

#head file
FILTER_MANAGERHEAD=filterManager_head

#body file
FILTER_MANAGERBODY=filterManager_description

#Directory to save files
TMPDIR=/Users/virieux/tmp/

cd $RESOURCES_DIR

### save existing filterManager description file ###
echo "Saving $FILTER_MANAGER_FILENAME in $TMPDIR"
DATE=`date '+%Y%m%d_%H%M%S'`
cp $FILTER_MANAGER_FILENAME $TMPDIR/$FILTER_MANAGER_FILENAME.$DATE

### Generation of file FILTER_MANAGER_FILENAME

echo "Generation of $FILTER_MANAGER_FILENAME from $FILTER_MANAGERHEAD, $FILTER_MANAGERBODY"

chmod u+w $FILTER_MANAGER_FILENAME
cat $FILTER_MANAGERHEAD  > $FILTER_MANAGER_FILENAME
cat $FILTER_MANAGERBODY|sed 's/filterManager/main/g' >> $FILTER_MANAGER_FILENAME
chmod u-w $FILTER_MANAGER_FILENAME

