auto_gene_i3dv.ksh
2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/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 "---------------------"