auto_gene_i3dv.ksh 2.38 KB
#!/bin/ksh
#------------------------------------------------------------------------------
# NAME : $RCSfile: auto_gene_i3dv.ksh,v $
# FUNCTION : 3dview impex automatic generation
# ORIGIN : GFI Informatique
# PROJECT :
# PARAMETERS :
#       1 : tar.gz distrib file - MI
#------------------------------------------------------------------------------
# HISTORY
# VERSION : 10/11/2009 : LBE
#           Creation
# END-HISTORY
# -----------------------------------------------------------------------------
# RCS $Id: auto_gene_i3dv.ksh 28 2013-12-11 14:24:50Z lbeigbeder $

# Shell usage
################
usage ()
{
        echo "Usage : $0 <source tar.gz file>"
        echo " i.e. auto_gene_i3dv.ksh mm3dview-V1_0.tar.gz"
}


#Parameter test
check_args ()
{
        if [ $1 -ne 1 ]
        then
                usage
                exit 1
        fi

        if  [ ! -f $2  ]
        then
                usage
                echo "tar file $2 does not exist."
                exit 1
        fi


}


# Tests arguments
check_args $# $1

tar_file=$1
echo $tar_file |cut -c15- |cut -d"." -f1 |read version

echo `pwd`|read install_dir
#goto home dir
cd



# check env file existence
if [ -d i3dv_old -a -d i3dv ]
then
  echo "i3dv_old found, delting it"
  \rm -rf i3dv_old
fi

if [ -d i3dv ]
then
  echo "Existing i3dv folder found, moving it to i3dv_old"
  mv i3dv i3dv_old
fi


#uncompress in home dir
gzip -dc $install_dir/$tar_file | tar xvf -


# check env file existence
if [ ! -f i3dv/install/env_i3dv ]
then
  echo "File install/env_i3dv not found !"
  exit 1
fi

. i3dv/install/init_i3dv.ksh

#echo copy delivered conf files
echo "Rename old conf files and copy new ones..."
prev_version=old
cd $I3DV_DPC_DIR/conf
for confFile in `ls`;
do
	if [ -f $I3DV_CONF_DIR/${confFile} ]; then
		echo Rename ${confFile} in ${confFile}_${prev_version};
		mv $I3DV_CONF_DIR/${confFile}  $I3DV_CONF_DIR/${confFile}_${prev_version};
	fi
	echo Copy $I3DV_DPC_DIR/conf/${confFile} in  $I3DV_CONF_DIR;
	cp -r $I3DV_DPC_DIR/conf/${confFile}  $I3DV_CONF_DIR/${confFile};
done


echo "****************************************"
echo "*                                      *"
echo "*         SOFTWARE GENERATION          *"
echo "*                                      *"
echo "****************************************"

cd $I3DV_ROOT/tools
./mkproj.ksh


echo "---------------------"
echo "  END OF GENERATION  "
echo "---------------------"