#!/bin/sh
## /public/scripts/cpz2h
## A Script to copy Z2H files from Z2H dev. env to GIN dev. env.
## 1. The configuration (version) name
##
if [ $# -lt 1 ]; then
echo "Usage: $0 configuration-name"
echo "Example: $0 prd_2.0"
exit 1
fi
CNFNAME=$1
CNFROOTDIR=`p4 where //Globecom/$CNFNAME/Globecom/Z2H/XmlConvertor | awk '{print $NF}' | sed 's?/Globecom/Z2H/XmlConvertor??'`
if [ ! -d $CNFROOTDIR ]
then
echo ""
echo $CNFROOTDIR" is not exist."
echo "Exit..."
echo ""
exit 1
fi
cd $CNFROOTDIR
pwd
for i in `cat $CNFROOTDIR/Globecom/Z2H/XmlConvertor/cpz2h.txt`
do
echo "copying "$i
IC=`echo $i | sed 's/.cpp/.C/'`
BASEI=`echo $i | awk -F/ '{print $NF}'`
BASEIC=`echo $IC | awk -F/ '{print $NF}'`
rm -f $CNFROOTDIR/Globecom/GIN/Z2H/$BASEI
rm -f $CNFROOTDIR/Globecom/GIN/Z2H/$BASEIC
cp $CNFROOTDIR/Globecom/Z2H/XmlConvertor/$i $CNFROOTDIR/Globecom/GIN/Z2H
done
echo "Finished copying from "$CNFROOTDIR"/Globecom/Z2H/XmlConvertor"
for j in `ls -l $HOME/Z2H_templates/$CNFNAME | tail +2 | awk '{print $NF}'`
do
echo "copying "$j
rm -f $CNFROOTDIR/Globecom/GIN/Z2H/$j
cp $HOME/Z2H_templates/$CNFNAME/$j $CNFROOTDIR/Globecom/GIN/Z2H/$j
done
echo "Finished copying from ~/Z2H_templates/"$CNFNAME
cd $CNFROOTDIR/Globecom/GIN/Z2H
for k in `ls -l *.cpp | awk '{print $NF}'`
do
KNAME=`echo $k | awk -F. '{print $1 ".C"}'`
echo "Renaming "$k" to "$KNAME
mv $k $KNAME
done
echo "Finished renaming *.cpp to *.C"
cd $CNFROOTDIR
pwd
exit 0